[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: How to change _ENV's value in a pure C function?
- From: Xavier Wang <weasley.wx@...>
- Date: Sat, 24 Dec 2011 10:48:29 +0800
Hi list,
I'm wonder how to change _ENV's value, or rebuild a new _ENV locals in
C function. the only idea I make out is using a wrapping lua code:
lua_newtable(L);
lua_pushcfunction(L, myfunc);
luaL_loadstring(L, "local _ENV,func = ... return func()");
lua_call(L, 2, 0);
Is there any other method to change _ENV in a C function using a pure C API?
regards :-)
- Xavier