Open SoniEx2 opened 7 years ago
lua_pushcclosure should push the parent lua_State as the first upvalue and a "function specifier" as the second upvalue.
the passed lua function should go on the parent lua_State's registry, and that's where the "function specifier" comes from.
lua_pushcclosure(function(L) print(L) print("virtualization!") return 0 end)
debug.* API wouldn't get much from those C closures, making this an effective sandbox.
This general idea makes sense to me. I'll add it to my todo list and hopefully get to that soon. Thanks!
lua_pushcclosure should push the parent lua_State as the first upvalue and a "function specifier" as the second upvalue.
the passed lua function should go on the parent lua_State's registry, and that's where the "function specifier" comes from.
debug.* API wouldn't get much from those C closures, making this an effective sandbox.