I'm just getting started with LUA.
In my interface code, it would be very helpful to be able to specify a function like
Toggle_Indirect(state, "ASAVEDVARIABLE.SUBELEMENT")
that sets ASAVEDVARIABLE.SUBELEMENT to the value of state.
But code like:
Code:
function Toggle_Indirect( state, globalName )
myPrint("_Indirect got "..tostring(state).." and ["..globalName);
-- apply the new state to the desired global
setglobal(globalName, state);
local derf = getglobal(globalName);
myPrint("_Indirect after set "..tostring(derf));
-- and let the addon know there has been a configuration change
ConfigurationChange();
end
Doesn't do the job. the prints indicate that a global with the right name has been set properly, but this apparently is not the saved variable, because the configuration change routine sees the old value.
What's the idiom in LUA for doing this kind of thing?