|
I have got a question about debug.getupvalue : why is it forbidden to get an upvalue value from a C function in Lua ?
It's merely a security thing. Lua should not be able to modify a C functions upvalues, which getupvalue would allow in the case of tables or userdata. Eg the common case of having a metatable as an upvalue. You're right though, for immutable types such as numbers and strings there'd be no danger. There's no harm in writing your own getupvalue using the C API though.
- Alex