function SetRegister(regname, val)
local inst = mc.mcGetInstance()
local hreg = mc.mcRegGetHandle(inst, string.format("iRegs0/%s", regname))
mc.mcRegSetValueString(hreg, val)
if (debug_scp == 1) then
mc.mcCntlSetLastError(inst, "regname = " .. regname .. "val = " .. val)
end
end
I'm attempting to use registers to store script values. This has the effect of having human readable names for variables in a script instead of #var's.
The function above should work and does if there are values already in register "regname". I would like my script to be able to initialize the Register variables and this is proving impossible to implement as the mc.mcRegGetHandle() will not create a variable. it will only return an already existing variable handle. I've looked all over and see no function for creating a Register variable from lua.
or else I'm missing something.