Originally Posted by Harven
So the toggleFunction is something like this? :
Lua Code:
toggleFunction = "local arg = (select(1,...)) if arg == something then return 'ToggleLocation' elseif arg == somethingelse then return 'ToggleFPS' else return 'ToggleSomething' end"
|
No. It is simply
toggleFunction = "Toggle"..lblName
Originally Posted by Iyanga
You don't. You need to use a table. Sorry.
local MyLocalFuncTable = {
["toggleFunction"] = ToggleLocation
}
MyLocalFuncTable[buttonname]()
When buttonname equals the string "toggleFunction", then ToggleLocation will be called.
(I didn't quite get what your locals and globals where, so I might have mixed up their names.)
|
Yeah, in the end I think I will need to go to some sort of global table if I want to keep the functions local. Not quite in this way if what I am reading is correct. I would still like to dynamically change what comes after Toggle on each iteration if I can help it because it keeps the code concise.