whoward69
DLL Minion
Just thought I'd throw this out there (partly so when I next search for the answer, Google will find it!)
Given a function abc
and some data values
we can call it
and get the expected output
But we can also put the name of the function into a variable
execute the function based on the contents of the variable
and also get the expected output
Enjoy!
Given a function abc
Code:
function abc(iData1, iData2)
return string.format("Data1=%i, Data2=%i", iData1, iData2);
end
and some data values
Code:
local i1 = 40
local i2 = 60
we can call it
Code:
print(abc(i1, i2))
Code:
Data1=40, Data2=60
But we can also put the name of the function into a variable
Code:
local xyz = "abc"
Code:
print(loadstring("return " .. xyz .. "(...)")(i1, i2))
Code:
Data1=40, Data2=60
Enjoy!