|
At 2012-07-16 18:12:46,"Patrick Rapin" <toupie300@gmail.com> wro te: >> GetValue's C code: >> static int GetValue_Factory(lua_State *L) >> { >> lua_pushcclosure(L, GetValue, 2); >> return 1; >> } >> >> static int GetValue(lua_State *L) >> { >> lua_pushvalue(L, lua_upvalueindex(1)); >> lua_gettable(L, lua_upvalueindex(2)); >> return 1; >> } > >I am a bit puzzled with that piece of code. >The GetValue function takes no argument from Lua stack, but takes two >constant arguments from its upvalues. >When you wrote "GetValue( 0, table )" or "GetValue( '0', table )", did >you actually call the GetValue_Factory C function ? >If yes, you have to call the resulting function value: "GetValue ( 0, >table ) ( ) ". >If no, the arguments would be just ignored. >Could you explain a little bit more the situation ? >