[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: sandboxing embedded 5.2
- From: Jeremy Carter <jeremy@...>
- Date: Sat, 22 Sep 2012 15:15:52 -0400
Well that was really easy, thank you Enrico!
If anyone cares, my mistake was assuming that variables assigned
inside the custom _ENV would be "globals" (i.e. retrievable with the C
API's lua_getglobal()). They are in fact fields of my custom _ENV
table (the sandbox_env table in the example I posted), retrievable in
C by first doing:
lua_getglobal(L, "sandbox_env");
then doing:
lua_getfield(L, -1, "my_variable");
This is very elegant as is the rest of Lua, thanks to everyone who
helped make such a nice language!