Argument detection in $(eval)

Is there a way to use the $(eval) variable to determine a command’s output based on how many arguments that command is given, or whether or not there are any?

@tulsaeh

You can nest variables like $(query)/$(querystring)/$(1-9)/$(touser) inside $(eval) such that you can manipulate them as JS variables (store them as strings, integers, floats, etc). For example, the following will tell you how many arguments you’ve supplied. The $(querystring) and $(user) variables have been nested in $(eval) such that the JS code will treat them like strings:

$(eval a=decodeURIComponent(`$(querystring)`).split(` `);b=a[0]?a.length:0;`$(user) has supplied ${b} arguments.`)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.