can i store functions attributes to use them later?
Posted: Wed Jun 19, 2019 10:20 am
Here is a piece of test code that does do what I want basically:
What I am trying to do, is to add functions to a table. Idea being that when i execute them, it will also include attributes for that function.
In case I am using wrong word here, what I mean here is:
Function is the "Checklocation()" by Attributes I mean "x" and "y".
In best case, I could just do like this:
And it would result "CheckLocation(100, 200)" being executed.
Second best case would be:
resulting in "CheckLocation(100, 200)" being executed.
That by other words, Attributestable[1] would contain "(100, 200)" inside it.
But is there any way to do it something like this, or do I have to resort into using the first, working example?
Code: Select all
functable = {}
Function func1 (a, b)
DebugPrint(a)
DebugPrint(b)
EndFunction
InsertItem(functable, {func=func1, attributes={5, 4} })
functable[0].func(functable[0].attributes[0], functable[0].attributes[1])In case I am using wrong word here, what I mean here is:
Code: Select all
function checklocation(x, y)In best case, I could just do like this:
Code: Select all
FunctionTable[1]Second best case would be:
Code: Select all
FunctionTable[1](attributestable[1])That by other words, Attributestable[1] would contain "(100, 200)" inside it.
But is there any way to do it something like this, or do I have to resort into using the first, working example?