68 while (lua_gettop(s) > 0) {
105 lua_gettable(luastate, LUA_REGISTRYINDEX);
106 void *
tv = lua_touserdata(luastate, -1);
113 lua_pushlightuserdata(luastate, (
void *)
tv);
114 lua_settable(luastate, LUA_REGISTRYINDEX);
121 lua_gettable(luastate, LUA_REGISTRYINDEX);
122 void *p = lua_touserdata(luastate, -1);
129 lua_pushlightuserdata(luastate, (
void *)p);
130 lua_settable(luastate, LUA_REGISTRYINDEX);
137 lua_gettable(luastate, LUA_REGISTRYINDEX);
138 void *tx = lua_touserdata(luastate, -1);
146 lua_gettable(luastate, LUA_REGISTRYINDEX);
147 uint64_t tx_id = lua_tointeger(luastate, -1);
153 lua_pushlightuserdata(luastate, (
void *)txptr);
154 lua_settable(luastate, LUA_REGISTRYINDEX);
157 lua_pushinteger(luastate, tx_id);
158 lua_settable(luastate, LUA_REGISTRYINDEX);
166 lua_gettable(luastate, LUA_REGISTRYINDEX);
167 f = lua_touserdata(luastate, -1);
171 lua_gettable(luastate, LUA_REGISTRYINDEX);
180 lua_pushlightuserdata(luastate, (
void *)f);
181 lua_settable(luastate, LUA_REGISTRYINDEX);
186 lua_pushboolean(luastate, 0);
187 lua_settable(luastate, LUA_REGISTRYINDEX);
194 lua_gettable(luastate, LUA_REGISTRYINDEX);
195 void *pa = lua_touserdata(luastate, -1);
202 lua_pushlightuserdata(luastate, (
void *)pa);
203 lua_settable(luastate, LUA_REGISTRYINDEX);
210 lua_gettable(luastate, LUA_REGISTRYINDEX);
211 void *s = lua_touserdata(luastate, -1);
218 lua_pushlightuserdata(luastate, (
void *)s);
219 lua_settable(luastate, LUA_REGISTRYINDEX);
226 lua_gettable(luastate, LUA_REGISTRYINDEX);
227 void *file = lua_touserdata(luastate, -1);
234 lua_pushlightuserdata(luastate, (
void *)file);
235 lua_settable(luastate, LUA_REGISTRYINDEX);
242 lua_gettable(luastate, LUA_REGISTRYINDEX);
243 void *det_ctx = lua_touserdata(luastate, -1);
250 lua_pushlightuserdata(luastate, (
void *)det_ctx);
251 lua_settable(luastate, LUA_REGISTRYINDEX);
257 lua_gettable(luastate, LUA_REGISTRYINDEX);
258 void *b = lua_touserdata(luastate, -1);
265 lua_pushlightuserdata(luastate, (
void *)b);
266 lua_settable(luastate, LUA_REGISTRYINDEX);
273 lua_gettable(luastate, LUA_REGISTRYINDEX);
274 int dir = lua_toboolean(luastate, -1);
281 lua_pushboolean(luastate, direction);
282 lua_settable(luastate, LUA_REGISTRYINDEX);
287 int size = lua_gettop(state);
290 for (i = 1; i <= size; i++) {
291 int type = lua_type(state, i);
292 printf(
"Stack size=%d, level=%d, type=%d, ", size, i,
type);
296 printf(
"function %s", lua_tostring(state, i) ?
"true" :
"false");
299 printf(
"bool %s", lua_toboolean(state, i) ?
"true" :
"false");
302 printf(
"number %g", lua_tonumber(state, i));
305 printf(
"string `%s'", lua_tostring(state, i));
308 printf(
"table `%s'", lua_tostring(state, i));
311 printf(
"other %s", lua_typename(state,
type));
321 if (input_len % 4 != 0) {
326 size_t buflen = input_len + 1 + ((input_len + 1) % 4);
328 memset(buf, 0x00, buflen);
329 memcpy(buf, input, input_len);
330 buf[input_len] =
'\0';
333 lua_pushlstring(luastate, (
char *)buf, input_len);
335 lua_pushlstring(luastate, (
char *)input, input_len);
342 lua_pushinteger(luastate, n);