lua_api_demo icon indicating copy to clipboard operation
lua_api_demo copied to clipboard

Support lua_pushcclosure

Open SoniEx2 opened this issue 7 years ago • 1 comments

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.

SoniEx2 avatar Nov 28 '17 19:11 SoniEx2

This general idea makes sense to me. I'll add it to my todo list and hopefully get to that soon. Thanks!

tylerneylon avatar Nov 28 '17 22:11 tylerneylon