ldblib.c
Go to the documentation of this file.
1 /*
2 ** $Id: ldblib.c $
3 ** Interface from Lua to its debug API
4 ** See Copyright Notice in lua.h
5 */
6 
7 #define ldblib_c
8 #define LUA_LIB
9 
10 #include "lprefix.h"
11 
12 
13 #include <stdio.h>
14 #include <stdlib.h>
15 #include <string.h>
16 
17 #include "lua.h"
18 
19 #include "lauxlib.h"
20 #include "lualib.h"
21 
22 
23 /*
24 ** The hook table at registry[HOOKKEY] maps threads to their current
25 ** hook function.
26 */
27 static const char *const HOOKKEY = "_HOOKKEY";
28 
29 
30 /*
31 ** If L1 != L, L1 can be in any state, and therefore there are no
32 ** guarantees about its stack space; any push in L1 must be
33 ** checked.
34 */
35 static void checkstack (lua_State *L, lua_State *L1, int n) {
36  if (l_unlikely(L != L1 && !lua_checkstack(L1, n)))
37  luaL_error(L, "stack overflow");
38 }
39 
40 
41 static int db_getregistry (lua_State *L) {
43  return 1;
44 }
45 
46 
47 static int db_getmetatable (lua_State *L) {
48  luaL_checkany(L, 1);
49  if (!lua_getmetatable(L, 1)) {
50  lua_pushnil(L); /* no metatable */
51  }
52  return 1;
53 }
54 
55 
56 static int db_setmetatable (lua_State *L) {
57  int t = lua_type(L, 2);
58  luaL_argexpected(L, t == LUA_TNIL || t == LUA_TTABLE, 2, "nil or table");
59  lua_settop(L, 2);
60  lua_setmetatable(L, 1);
61  return 1; /* return 1st argument */
62 }
63 
64 
65 static int db_getuservalue (lua_State *L) {
66  int n = (int)luaL_optinteger(L, 2, 1);
67  if (lua_type(L, 1) != LUA_TUSERDATA)
68  luaL_pushfail(L);
69  else if (lua_getiuservalue(L, 1, n) != LUA_TNONE) {
70  lua_pushboolean(L, 1);
71  return 2;
72  }
73  return 1;
74 }
75 
76 
77 static int db_setuservalue (lua_State *L) {
78  int n = (int)luaL_optinteger(L, 3, 1);
80  luaL_checkany(L, 2);
81  lua_settop(L, 2);
82  if (!lua_setiuservalue(L, 1, n))
83  luaL_pushfail(L);
84  return 1;
85 }
86 
87 
88 /*
89 ** Auxiliary function used by several library functions: check for
90 ** an optional thread as function's first argument and set 'arg' with
91 ** 1 if this argument is present (so that functions can skip it to
92 ** access their other arguments)
93 */
94 static lua_State *getthread (lua_State *L, int *arg) {
95  if (lua_isthread(L, 1)) {
96  *arg = 1;
97  return lua_tothread(L, 1);
98  }
99  else {
100  *arg = 0;
101  return L; /* function will operate over current thread */
102  }
103 }
104 
105 
106 /*
107 ** Variations of 'lua_settable', used by 'db_getinfo' to put results
108 ** from 'lua_getinfo' into result table. Key is always a string;
109 ** value can be a string, an int, or a boolean.
110 */
111 static void settabss (lua_State *L, const char *k, const char *v) {
112  lua_pushstring(L, v);
113  lua_setfield(L, -2, k);
114 }
115 
116 static void settabsi (lua_State *L, const char *k, int v) {
117  lua_pushinteger(L, v);
118  lua_setfield(L, -2, k);
119 }
120 
121 static void settabsb (lua_State *L, const char *k, int v) {
122  lua_pushboolean(L, v);
123  lua_setfield(L, -2, k);
124 }
125 
126 
127 /*
128 ** In function 'db_getinfo', the call to 'lua_getinfo' may push
129 ** results on the stack; later it creates the result table to put
130 ** these objects. Function 'treatstackoption' puts the result from
131 ** 'lua_getinfo' on top of the result table so that it can call
132 ** 'lua_setfield'.
133 */
134 static void treatstackoption (lua_State *L, lua_State *L1, const char *fname) {
135  if (L == L1)
136  lua_rotate(L, -2, 1); /* exchange object and table */
137  else
138  lua_xmove(L1, L, 1); /* move object to the "main" stack */
139  lua_setfield(L, -2, fname); /* put object into table */
140 }
141 
142 
143 /*
144 ** Calls 'lua_getinfo' and collects all results in a new table.
145 ** L1 needs stack space for an optional input (function) plus
146 ** two optional outputs (function and line table) from function
147 ** 'lua_getinfo'.
148 */
149 static int db_getinfo (lua_State *L) {
150  lua_Debug ar;
151  int arg;
152  lua_State *L1 = getthread(L, &arg);
153  const char *options = luaL_optstring(L, arg+2, "flnSrtu");
154  checkstack(L, L1, 3);
155  luaL_argcheck(L, options[0] != '>', arg + 2, "invalid option '>'");
156  if (lua_isfunction(L, arg + 1)) { /* info about a function? */
157  options = lua_pushfstring(L, ">%s", options); /* add '>' to 'options' */
158  lua_pushvalue(L, arg + 1); /* move function to 'L1' stack */
159  lua_xmove(L, L1, 1);
160  }
161  else { /* stack level */
162  if (!lua_getstack(L1, (int)luaL_checkinteger(L, arg + 1), &ar)) {
163  luaL_pushfail(L); /* level out of range */
164  return 1;
165  }
166  }
167  if (!lua_getinfo(L1, options, &ar))
168  return luaL_argerror(L, arg+2, "invalid option");
169  lua_newtable(L); /* table to collect results */
170  if (strchr(options, 'S')) {
171  lua_pushlstring(L, ar.source, ar.srclen);
172  lua_setfield(L, -2, "source");
173  settabss(L, "short_src", ar.short_src);
174  settabsi(L, "linedefined", ar.linedefined);
175  settabsi(L, "lastlinedefined", ar.lastlinedefined);
176  settabss(L, "what", ar.what);
177  }
178  if (strchr(options, 'l'))
179  settabsi(L, "currentline", ar.currentline);
180  if (strchr(options, 'u')) {
181  settabsi(L, "nups", ar.nups);
182  settabsi(L, "nparams", ar.nparams);
183  settabsb(L, "isvararg", ar.isvararg);
184  }
185  if (strchr(options, 'n')) {
186  settabss(L, "name", ar.name);
187  settabss(L, "namewhat", ar.namewhat);
188  }
189  if (strchr(options, 'r')) {
190  settabsi(L, "ftransfer", ar.ftransfer);
191  settabsi(L, "ntransfer", ar.ntransfer);
192  }
193  if (strchr(options, 't'))
194  settabsb(L, "istailcall", ar.istailcall);
195  if (strchr(options, 'L'))
196  treatstackoption(L, L1, "activelines");
197  if (strchr(options, 'f'))
198  treatstackoption(L, L1, "func");
199  return 1; /* return table */
200 }
201 
202 
203 static int db_getlocal (lua_State *L) {
204  int arg;
205  lua_State *L1 = getthread(L, &arg);
206  int nvar = (int)luaL_checkinteger(L, arg + 2); /* local-variable index */
207  if (lua_isfunction(L, arg + 1)) { /* function argument? */
208  lua_pushvalue(L, arg + 1); /* push function */
209  lua_pushstring(L, lua_getlocal(L, NULL, nvar)); /* push local name */
210  return 1; /* return only name (there is no value) */
211  }
212  else { /* stack-level argument */
213  lua_Debug ar;
214  const char *name;
215  int level = (int)luaL_checkinteger(L, arg + 1);
216  if (l_unlikely(!lua_getstack(L1, level, &ar))) /* out of range? */
217  return luaL_argerror(L, arg+1, "level out of range");
218  checkstack(L, L1, 1);
219  name = lua_getlocal(L1, &ar, nvar);
220  if (name) {
221  lua_xmove(L1, L, 1); /* move local value */
222  lua_pushstring(L, name); /* push name */
223  lua_rotate(L, -2, 1); /* re-order */
224  return 2;
225  }
226  else {
227  luaL_pushfail(L); /* no name (nor value) */
228  return 1;
229  }
230  }
231 }
232 
233 
234 static int db_setlocal (lua_State *L) {
235  int arg;
236  const char *name;
237  lua_State *L1 = getthread(L, &arg);
238  lua_Debug ar;
239  int level = (int)luaL_checkinteger(L, arg + 1);
240  int nvar = (int)luaL_checkinteger(L, arg + 2);
241  if (l_unlikely(!lua_getstack(L1, level, &ar))) /* out of range? */
242  return luaL_argerror(L, arg+1, "level out of range");
243  luaL_checkany(L, arg+3);
244  lua_settop(L, arg+3);
245  checkstack(L, L1, 1);
246  lua_xmove(L, L1, 1);
247  name = lua_setlocal(L1, &ar, nvar);
248  if (name == NULL)
249  lua_pop(L1, 1); /* pop value (if not popped by 'lua_setlocal') */
250  lua_pushstring(L, name);
251  return 1;
252 }
253 
254 
255 /*
256 ** get (if 'get' is true) or set an upvalue from a closure
257 */
258 static int auxupvalue (lua_State *L, int get) {
259  const char *name;
260  int n = (int)luaL_checkinteger(L, 2); /* upvalue index */
261  luaL_checktype(L, 1, LUA_TFUNCTION); /* closure */
262  name = get ? lua_getupvalue(L, 1, n) : lua_setupvalue(L, 1, n);
263  if (name == NULL) return 0;
264  lua_pushstring(L, name);
265  lua_insert(L, -(get+1)); /* no-op if get is false */
266  return get + 1;
267 }
268 
269 
270 static int db_getupvalue (lua_State *L) {
271  return auxupvalue(L, 1);
272 }
273 
274 
275 static int db_setupvalue (lua_State *L) {
276  luaL_checkany(L, 3);
277  return auxupvalue(L, 0);
278 }
279 
280 
281 /*
282 ** Check whether a given upvalue from a given closure exists and
283 ** returns its index
284 */
285 static void *checkupval (lua_State *L, int argf, int argnup, int *pnup) {
286  void *id;
287  int nup = (int)luaL_checkinteger(L, argnup); /* upvalue index */
288  luaL_checktype(L, argf, LUA_TFUNCTION); /* closure */
289  id = lua_upvalueid(L, argf, nup);
290  if (pnup) {
291  luaL_argcheck(L, id != NULL, argnup, "invalid upvalue index");
292  *pnup = nup;
293  }
294  return id;
295 }
296 
297 
298 static int db_upvalueid (lua_State *L) {
299  void *id = checkupval(L, 1, 2, NULL);
300  if (id != NULL)
301  lua_pushlightuserdata(L, id);
302  else
303  luaL_pushfail(L);
304  return 1;
305 }
306 
307 
308 static int db_upvaluejoin (lua_State *L) {
309  int n1, n2;
310  checkupval(L, 1, 2, &n1);
311  checkupval(L, 3, 4, &n2);
312  luaL_argcheck(L, !lua_iscfunction(L, 1), 1, "Lua function expected");
313  luaL_argcheck(L, !lua_iscfunction(L, 3), 3, "Lua function expected");
314  lua_upvaluejoin(L, 1, n1, 3, n2);
315  return 0;
316 }
317 
318 
319 /*
320 ** Call hook function registered at hook table for the current
321 ** thread (if there is one)
322 */
323 static void hookf (lua_State *L, lua_Debug *ar) {
324  static const char *const hooknames[] =
325  {"call", "return", "line", "count", "tail call"};
327  lua_pushthread(L);
328  if (lua_rawget(L, -2) == LUA_TFUNCTION) { /* is there a hook function? */
329  lua_pushstring(L, hooknames[(int)ar->event]); /* push event name */
330  if (ar->currentline >= 0)
331  lua_pushinteger(L, ar->currentline); /* push current line */
332  else lua_pushnil(L);
333  lua_assert(lua_getinfo(L, "lS", ar));
334  lua_call(L, 2, 0); /* call hook function */
335  }
336 }
337 
338 
339 /*
340 ** Convert a string mask (for 'sethook') into a bit mask
341 */
342 static int makemask (const char *smask, int count) {
343  int mask = 0;
344  if (strchr(smask, 'c')) mask |= LUA_MASKCALL;
345  if (strchr(smask, 'r')) mask |= LUA_MASKRET;
346  if (strchr(smask, 'l')) mask |= LUA_MASKLINE;
347  if (count > 0) mask |= LUA_MASKCOUNT;
348  return mask;
349 }
350 
351 
352 /*
353 ** Convert a bit mask (for 'gethook') into a string mask
354 */
355 static char *unmakemask (int mask, char *smask) {
356  int i = 0;
357  if (mask & LUA_MASKCALL) smask[i++] = 'c';
358  if (mask & LUA_MASKRET) smask[i++] = 'r';
359  if (mask & LUA_MASKLINE) smask[i++] = 'l';
360  smask[i] = '\0';
361  return smask;
362 }
363 
364 
365 static int db_sethook (lua_State *L) {
366  int arg, mask, count;
367  lua_Hook func;
368  lua_State *L1 = getthread(L, &arg);
369  if (lua_isnoneornil(L, arg+1)) { /* no hook? */
370  lua_settop(L, arg+1);
371  func = NULL; mask = 0; count = 0; /* turn off hooks */
372  }
373  else {
374  const char *smask = luaL_checkstring(L, arg+2);
376  count = (int)luaL_optinteger(L, arg + 3, 0);
377  func = hookf; mask = makemask(smask, count);
378  }
380  /* table just created; initialize it */
381  lua_pushliteral(L, "k");
382  lua_setfield(L, -2, "__mode");
383  lua_pushvalue(L, -1);
384  lua_setmetatable(L, -2); /* metatable(hooktable) = hooktable */
385  }
386  checkstack(L, L1, 1);
387  lua_pushthread(L1); lua_xmove(L1, L, 1); /* key (thread) */
388  lua_pushvalue(L, arg + 1); /* value (hook function) */
389  lua_rawset(L, -3); /* hooktable[L1] = new Lua hook */
390  lua_sethook(L1, func, mask, count);
391  return 0;
392 }
393 
394 
395 static int db_gethook (lua_State *L) {
396  int arg;
397  lua_State *L1 = getthread(L, &arg);
398  char buff[5];
399  int mask = lua_gethookmask(L1);
400  lua_Hook hook = lua_gethook(L1);
401  if (hook == NULL) { /* no hook? */
402  luaL_pushfail(L);
403  return 1;
404  }
405  else if (hook != hookf) /* external hook? */
406  lua_pushliteral(L, "external hook");
407  else { /* hook table must exist */
409  checkstack(L, L1, 1);
410  lua_pushthread(L1); lua_xmove(L1, L, 1);
411  lua_rawget(L, -2); /* 1st result = hooktable[L1] */
412  lua_remove(L, -2); /* remove hook table */
413  }
414  lua_pushstring(L, unmakemask(mask, buff)); /* 2nd result = mask */
415  lua_pushinteger(L, lua_gethookcount(L1)); /* 3rd result = count */
416  return 3;
417 }
418 
419 
420 static int db_debug (lua_State *L) {
421  for (;;) {
422  char buffer[250];
423  lua_writestringerror("%s", "lua_debug> ");
424  if (fgets(buffer, sizeof(buffer), stdin) == NULL ||
425  strcmp(buffer, "cont\n") == 0)
426  return 0;
427  if (luaL_loadbuffer(L, buffer, strlen(buffer), "=(debug command)") ||
428  lua_pcall(L, 0, 0, 0))
429  lua_writestringerror("%s\n", luaL_tolstring(L, -1, NULL));
430  lua_settop(L, 0); /* remove eventual returns */
431  }
432 }
433 
434 
435 static int db_traceback (lua_State *L) {
436  int arg;
437  lua_State *L1 = getthread(L, &arg);
438  const char *msg = lua_tostring(L, arg + 1);
439  if (msg == NULL && !lua_isnoneornil(L, arg + 1)) /* non-string 'msg'? */
440  lua_pushvalue(L, arg + 1); /* return it untouched */
441  else {
442  int level = (int)luaL_optinteger(L, arg + 2, (L == L1) ? 1 : 0);
443  luaL_traceback(L, L1, msg, level);
444  }
445  return 1;
446 }
447 
448 
449 static int db_setcstacklimit (lua_State *L) {
450  int limit = (int)luaL_checkinteger(L, 1);
451  int res = lua_setcstacklimit(L, limit);
452  lua_pushinteger(L, res);
453  return 1;
454 }
455 
456 
457 static const luaL_Reg dblib[] = {
458  {"debug", db_debug},
459  {"getuservalue", db_getuservalue},
460  {"gethook", db_gethook},
461  {"getinfo", db_getinfo},
462  {"getlocal", db_getlocal},
463  {"getregistry", db_getregistry},
464  {"getmetatable", db_getmetatable},
465  {"getupvalue", db_getupvalue},
466  {"upvaluejoin", db_upvaluejoin},
467  {"upvalueid", db_upvalueid},
468  {"setuservalue", db_setuservalue},
469  {"sethook", db_sethook},
470  {"setlocal", db_setlocal},
471  {"setmetatable", db_setmetatable},
472  {"setupvalue", db_setupvalue},
473  {"traceback", db_traceback},
474  {"setcstacklimit", db_setcstacklimit},
475  {NULL, NULL}
476 };
477 
478 
480  luaL_newlib(L, dblib);
481  return 1;
482 }
483 
luaL_optstring
#define luaL_optstring(L, n, d)
Definition: lauxlib.h:140
lua_gethookcount
LUA_API int lua_gethookcount(lua_State *L)
Definition: ldebug.c:155
lua_Debug::name
const char * name
Definition: lua.h:472
LUA_TFUNCTION
#define LUA_TFUNCTION
Definition: lua.h:71
lua_pushliteral
#define lua_pushliteral(L, s)
Definition: lua.h:382
lua_rotate
LUA_API void lua_rotate(lua_State *L, int idx, int n)
Definition: lapi.c:235
lua_pcall
#define lua_pcall(L, n, r, f)
Definition: lua.h:287
lua_Debug::what
const char * what
Definition: lua.h:474
lua_setupvalue
const LUA_API char * lua_setupvalue(lua_State *L, int funcindex, int n)
Definition: lapi.c:1390
lua_assert
#define lua_assert(c)
Definition: lauxlib.h:170
db_gethook
static int db_gethook(lua_State *L)
Definition: ldblib.c:395
lua_tostring
#define lua_tostring(L, i)
Definition: lua.h:387
luaL_Reg
Definition: lauxlib.h:38
db_upvalueid
static int db_upvalueid(lua_State *L)
Definition: ldblib.c:298
db_debug
static int db_debug(lua_State *L)
Definition: ldblib.c:420
luaL_checkstring
#define luaL_checkstring(L, n)
Definition: lauxlib.h:139
lua_checkstack
LUA_API int lua_checkstack(lua_State *L, int n)
Definition: lapi.c:99
lua_getfield
LUA_API int lua_getfield(lua_State *L, int idx, const char *k)
Definition: lapi.c:683
settabsb
static void settabsb(lua_State *L, const char *k, int v)
Definition: ldblib.c:121
LUA_TTABLE
#define LUA_TTABLE
Definition: lua.h:70
lua_pushthread
LUA_API int lua_pushthread(lua_State *L)
Definition: lapi.c:618
db_sethook
static int db_sethook(lua_State *L)
Definition: ldblib.c:365
lua_pushinteger
LUA_API void lua_pushinteger(lua_State *L, lua_Integer n)
Definition: lapi.c:507
lua_Debug::event
int event
Definition: lua.h:471
lua_getinfo
LUA_API int lua_getinfo(lua_State *L, const char *what, lua_Debug *ar)
Definition: ldebug.c:382
lua_getlocal
const LUA_API char * lua_getlocal(lua_State *L, const lua_Debug *ar, int n)
Definition: ldebug.c:220
LUA_MASKLINE
#define LUA_MASKLINE
Definition: lua.h:442
lua_remove
#define lua_remove(L, idx)
Definition: lua.h:392
lua_pop
#define lua_pop(L, n)
Definition: lua.h:365
unmakemask
static char * unmakemask(int mask, char *smask)
Definition: ldblib.c:355
lua_upvaluejoin
LUA_API void lua_upvaluejoin(lua_State *L, int fidx1, int n1, int fidx2, int n2)
Definition: lapi.c:1445
lua_iscfunction
LUA_API int lua_iscfunction(lua_State *L, int idx)
Definition: lapi.c:291
lua_pushfstring
const LUA_API char * lua_pushfstring(lua_State *L, const char *fmt,...)
Definition: lapi.c:560
treatstackoption
static void treatstackoption(lua_State *L, lua_State *L1, const char *fname)
Definition: ldblib.c:134
arg
auto arg(const Char *name, const T &arg) -> detail::named_arg< Char, T >
Definition: core.h:1875
lua_isnoneornil
#define lua_isnoneornil(L, n)
Definition: lua.h:380
dblib
static const luaL_Reg dblib[]
Definition: ldblib.c:457
luaL_loadbuffer
#define luaL_loadbuffer(L, s, sz, n)
Definition: lauxlib.h:154
lua_type
LUA_API int lua_type(lua_State *L, int idx)
Definition: lapi.c:278
lua_Debug::nups
unsigned char nups
Definition: lua.h:480
mqtt_test_proto.msg
msg
Definition: mqtt_test_proto.py:43
lua_setmetatable
LUA_API int lua_setmetatable(lua_State *L, int objindex)
Definition: lapi.c:927
lua_isthread
#define lua_isthread(L, n)
Definition: lua.h:378
luaopen_debug
LUAMOD_API int luaopen_debug(lua_State *L)
Definition: ldblib.c:479
lua_tothread
LUA_API lua_State * lua_tothread(lua_State *L, int idx)
Definition: lapi.c:456
lua_pushstring
const LUA_API char * lua_pushstring(lua_State *L, const char *s)
Definition: lapi.c:532
db_traceback
static int db_traceback(lua_State *L)
Definition: ldblib.c:435
lua_Debug::namewhat
const char * namewhat
Definition: lua.h:473
luaL_argexpected
#define luaL_argexpected(L, cond, arg, tname)
Definition: lauxlib.h:136
lua_isfunction
#define lua_isfunction(L, n)
Definition: lua.h:373
lua_Debug::source
const char * source
Definition: lua.h:475
lua.h
lua_Debug::srclen
size_t srclen
Definition: lua.h:476
lua_Debug::short_src
char short_src[LUA_IDSIZE]
Definition: lua.h:486
LUA_MASKCOUNT
#define LUA_MASKCOUNT
Definition: lua.h:443
lua_gethookmask
LUA_API int lua_gethookmask(lua_State *L)
Definition: ldebug.c:150
lua_Debug::ntransfer
unsigned short ntransfer
Definition: lua.h:485
detail::count
constexpr auto count() -> size_t
Definition: core.h:1222
lua_rawset
LUA_API void lua_rawset(lua_State *L, int idx)
Definition: lapi.c:903
db_getmetatable
static int db_getmetatable(lua_State *L)
Definition: ldblib.c:47
lua_insert
#define lua_insert(L, idx)
Definition: lua.h:390
lua_rawget
LUA_API int lua_rawget(lua_State *L, int idx)
Definition: lapi.c:726
db_getupvalue
static int db_getupvalue(lua_State *L)
Definition: ldblib.c:270
lua_setfield
LUA_API void lua_setfield(lua_State *L, int idx, const char *k)
Definition: lapi.c:865
lua_Debug::istailcall
char istailcall
Definition: lua.h:483
lua_sethook
LUA_API void lua_sethook(lua_State *L, lua_Hook func, int mask, int count)
Definition: ldebug.c:131
hookf
static void hookf(lua_State *L, lua_Debug *ar)
Definition: ldblib.c:323
lprefix.h
lua_Debug::lastlinedefined
int lastlinedefined
Definition: lua.h:479
LUA_TUSERDATA
#define LUA_TUSERDATA
Definition: lua.h:72
lua_State
Definition: lstate.h:304
luaL_argerror
LUALIB_API int luaL_argerror(lua_State *L, int arg, const char *extramsg)
Definition: lauxlib.c:175
db_getuservalue
static int db_getuservalue(lua_State *L)
Definition: ldblib.c:65
luaL_checkany
LUALIB_API void luaL_checkany(lua_State *L, int arg)
Definition: lauxlib.c:396
lua_setiuservalue
LUA_API int lua_setiuservalue(lua_State *L, int idx, int n)
Definition: lapi.c:967
auxupvalue
static int auxupvalue(lua_State *L, int get)
Definition: ldblib.c:258
LUA_REGISTRYINDEX
#define LUA_REGISTRYINDEX
Definition: lua.h:44
db_upvaluejoin
static int db_upvaluejoin(lua_State *L)
Definition: ldblib.c:308
checkstack
static void checkstack(lua_State *L, lua_State *L1, int n)
Definition: ldblib.c:35
lua_Hook
void(* lua_Hook)(lua_State *L, lua_Debug *ar)
Definition: lua.h:449
lua_getstack
LUA_API int lua_getstack(lua_State *L, int level, lua_Debug *ar)
Definition: ldebug.c:160
db_setuservalue
static int db_setuservalue(lua_State *L)
Definition: ldblib.c:77
lua_Debug::isvararg
char isvararg
Definition: lua.h:482
luaL_argcheck
#define luaL_argcheck(L, cond, arg, extramsg)
Definition: lauxlib.h:133
LUA_MASKCALL
#define LUA_MASKCALL
Definition: lua.h:440
lua_settop
LUA_API void lua_settop(lua_State *L, int idx)
Definition: lapi.c:174
lauxlib.h
lualib.h
lua_pushboolean
LUA_API void lua_pushboolean(lua_State *L, int b)
Definition: lapi.c:599
lua_setcstacklimit
LUA_API int lua_setcstacklimit(lua_State *L, unsigned int limit)
Definition: lstate.c:99
lua_pushvalue
LUA_API void lua_pushvalue(lua_State *L, int idx)
Definition: lapi.c:264
settabsi
static void settabsi(lua_State *L, const char *k, int v)
Definition: ldblib.c:116
luaL_checktype
LUALIB_API void luaL_checktype(lua_State *L, int arg, int t)
Definition: lauxlib.c:390
LUA_TNONE
#define LUA_TNONE
Definition: lua.h:63
db_setcstacklimit
static int db_setcstacklimit(lua_State *L)
Definition: ldblib.c:449
lua_getmetatable
LUA_API int lua_getmetatable(lua_State *L, int objindex)
Definition: lapi.c:769
makemask
static int makemask(const char *smask, int count)
Definition: ldblib.c:342
lua_call
#define lua_call(L, n, r)
Definition: lua.h:283
lua_gethook
LUA_API lua_Hook lua_gethook(lua_State *L)
Definition: ldebug.c:145
LUA_MASKRET
#define LUA_MASKRET
Definition: lua.h:441
udp_client.int
int
Definition: udp_client.py:11
HOOKKEY
static const char *const HOOKKEY
Definition: ldblib.c:27
LUA_TNIL
#define LUA_TNIL
Definition: lua.h:65
lua_pushlstring
const LUA_API char * lua_pushlstring(lua_State *L, const char *s, size_t len)
Definition: lapi.c:520
LUAMOD_API
#define LUAMOD_API
Definition: luaconf.h:291
lua_Debug::currentline
int currentline
Definition: lua.h:477
lua_xmove
LUA_API void lua_xmove(lua_State *from, lua_State *to, int n)
Definition: lapi.c:121
checkupval
static void * checkupval(lua_State *L, int argf, int argnup, int *pnup)
Definition: ldblib.c:285
lua_upvalueid
LUA_API void * lua_upvalueid(lua_State *L, int fidx, int n)
Definition: lapi.c:1423
luaL_optinteger
LUALIB_API lua_Integer luaL_optinteger(lua_State *L, int arg, lua_Integer def)
Definition: lauxlib.c:452
db_getlocal
static int db_getlocal(lua_State *L)
Definition: ldblib.c:203
lua_Debug::ftransfer
unsigned short ftransfer
Definition: lua.h:484
luaL_traceback
LUALIB_API void luaL_traceback(lua_State *L, lua_State *L1, const char *msg, int level)
Definition: lauxlib.c:131
luaL_newlib
#define luaL_newlib(L, l)
Definition: lauxlib.h:130
luaL_error
LUALIB_API int luaL_error(lua_State *L, const char *fmt,...)
Definition: lauxlib.c:234
db_setmetatable
static int db_setmetatable(lua_State *L)
Definition: ldblib.c:56
nlohmann::detail::get
auto get(const nlohmann::detail::iteration_proxy_value< IteratorType > &i) -> decltype(i.key())
Definition: json.hpp:4451
lua_writestringerror
#define lua_writestringerror(s, p)
Definition: lauxlib.h:262
lua_newtable
#define lua_newtable(L)
Definition: lua.h:367
getthread
static lua_State * getthread(lua_State *L, int *arg)
Definition: ldblib.c:94
lua_getupvalue
const LUA_API char * lua_getupvalue(lua_State *L, int funcindex, int n)
Definition: lapi.c:1376
luaL_checkinteger
LUALIB_API lua_Integer luaL_checkinteger(lua_State *L, int arg)
Definition: lauxlib.c:442
settabss
static void settabss(lua_State *L, const char *k, const char *v)
Definition: ldblib.c:111
luaL_getsubtable
LUALIB_API int luaL_getsubtable(lua_State *L, int idx, const char *fname)
Definition: lauxlib.c:947
lua_pushnil
LUA_API void lua_pushnil(lua_State *L)
Definition: lapi.c:491
lua_getiuservalue
LUA_API int lua_getiuservalue(lua_State *L, int idx, int n)
Definition: lapi.c:796
lua_Debug::nparams
unsigned char nparams
Definition: lua.h:481
lua_Debug
Definition: lua.h:470
db_setlocal
static int db_setlocal(lua_State *L)
Definition: ldblib.c:234
lua_Debug::linedefined
int linedefined
Definition: lua.h:478
db_setupvalue
static int db_setupvalue(lua_State *L)
Definition: ldblib.c:275
lua_setlocal
const LUA_API char * lua_setlocal(lua_State *L, const lua_Debug *ar, int n)
Definition: ldebug.c:242
db_getinfo
static int db_getinfo(lua_State *L)
Definition: ldblib.c:149
lua_pushlightuserdata
LUA_API void lua_pushlightuserdata(lua_State *L, void *p)
Definition: lapi.c:610
luaL_pushfail
#define luaL_pushfail(L)
Definition: lauxlib.h:158
luaL_tolstring
const LUALIB_API char * luaL_tolstring(lua_State *L, int idx, size_t *len)
Definition: lauxlib.c:883
db_getregistry
static int db_getregistry(lua_State *L)
Definition: ldblib.c:41


plotjuggler
Author(s): Davide Faconti
autogenerated on Mon Nov 11 2024 03:23:44