Original Post
I have found myself wanting to override a function's __index and __newindex metamethods. The reason for this is I have a simple C function to expose data to Lua and set a global name (or table index) for it. This means that I can print a C variable myvar in Lua using print(myvar) and set it using myvar(value). I would like to re-wire __index and __newindex to make this more like print(myvar) and myvar=value.
Is this even possible? I have tried using the C API and the debug library without success.
Is this even possible? I have tried using the C API and the debug library without success.