CactusBot icon indicating copy to clipboard operation
CactusBot copied to clipboard

Variables as variable defaults don't work

Open Alkali-Metal opened this issue 8 years ago • 8 comments

What is the issue?

When you put a variable as the default for another variable, it doesn't work, it returns the variable as it is.

How do we reproduce this issue?

image Do that.

Environment

Remote hosted CactusBot 0.4

Other Information

I feel as though it should work because it would make default arguments much coolio-er. :smile:

Also: default arguments for %ARGS% doesn't work, it returns Not enough arguments

Alkali-Metal avatar Mar 30 '17 02:03 Alkali-Metal

Hmm... this wasn't really considered. Could look into it, just making sure that recursion isn't an issue. :+1:

2Cubed avatar Mar 30 '17 02:03 2Cubed

Yeah, that would be a mild issue. XD

Alkali-Metal avatar Mar 30 '17 02:03 Alkali-Metal

Fixed this in #295

Innectic avatar May 06 '17 03:05 Innectic

Silly @Innectic. ;P

2Cubed avatar May 06 '17 03:05 2Cubed

Can confirm, am noob.

Innectic avatar May 06 '17 16:05 Innectic

You Innectato!

Alkali-Metal avatar May 12 '17 02:05 Alkali-Metal

So, I was thinking about this, and I would that only having one layer-o'-recursion would be fine, anything beyond that would just be pointless and redundant in my opinion.

One layer:   %ARGS=%NAME%%           #Would work
Two layers:  %ARGS=%ARG1=%NAME%%%    #Wouldn't work

If that makes any sense.

And it should check to see if they are the same so that it can't do something like %ARGS=%ARGS%%

Alkali-Metal avatar May 27 '17 06:05 Alkali-Metal

I would agree; having more than one layer doesn't really make sense.

The more I think about it, the more I think recursion might not be an issue... for example, with the response %ARG1=%ARG2%% %ARG2=%ARG1%%:

  • If no args, error message.
  • If only %ARG1% as a, response is a a.
  • If also %ARG2% as b, response is a b.

2Cubed avatar May 29 '17 20:05 2Cubed