Lines go like this:
Code: Select all
Function Func(Var, OptionalArgs)
Local Varname = "default"
Local Varname2 = "default"
if OptionalArgs <> Nil
If Hasitem(OptionalArgs, "varname") then Varname = OptionalArgs.Varname
If HasItem(OptionalArgs, "varname2") Then Varname2 = OptionalArgs.Varname2
...
Endif
At beginning of Function I am making Duration a Local variable, and assigning it some default value, but, if OptionalArgs has Duration in it, then this default value is replaced with the one in the OptionalArgs.
example usage:
Code: Select all
Func(12, {duration=100})
But all in all, I could well have just a Function that would check through all these OptionalArgs, even if it would then check through some unnecessary arguments, since they anyway wouldn't affect anything.
Idea being:
Code: Select all
Function Func(Var, OptionalArgs)
HandleOptionalArguments(OptionalArgs)
Code: Select all
Local O = {}
HandleOptionalArguments(O, OptionalArgs)
Debugprint(O.Varname1)
But is there any way to do this in such way that when I jump to "HandleOptionalArguments" function, that it would be able to assign values to Local variables in the function from where it jumped to that function?
There is for example this, was it "G[VarName]" which I can use to alter Global variables, but is there any way to alter Local functions same way perhaps?