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 != 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  if (lua_isfunction(L, arg + 1)) { /* info about a function? */
156  options = lua_pushfstring(L, ">%s", options); /* add '>' to 'options' */
157  lua_pushvalue(L, arg + 1); /* move function to 'L1' stack */
158  lua_xmove(L, L1, 1);
159  }
160  else { /* stack level */
161  if (!lua_getstack(L1, (int)luaL_checkinteger(L, arg + 1), &ar)) {
162  luaL_pushfail(L); /* level out of range */
163  return 1;
164  }
165  }
166  if (!lua_getinfo(L1, options, &ar))
167  return luaL_argerror(L, arg+2, "invalid option");
168  lua_newtable(L); /* table to collect results */
169  if (strchr(options, 'S')) {
170  lua_pushlstring(L, ar.source, ar.srclen);
171  lua_setfield(L, -2, "source");
172  settabss(L, "short_src", ar.short_src);
173  settabsi(L, "linedefined", ar.linedefined);
174  settabsi(L, "lastlinedefined", ar.lastlinedefined);
175  settabss(L, "what", ar.what);
176  }
177  if (strchr(options, 'l'))
178  settabsi(L, "currentline", ar.currentline);
179  if (strchr(options, 'u')) {
180  settabsi(L, "nups", ar.nups);
181  settabsi(L, "nparams", ar.nparams);
182  settabsb(L, "isvararg", ar.isvararg);
183  }
184  if (strchr(options, 'n')) {
185  settabss(L, "name", ar.name);
186  settabss(L, "namewhat", ar.namewhat);
187  }
188  if (strchr(options, 'r')) {
189  settabsi(L, "ftransfer", ar.ftransfer);
190  settabsi(L, "ntransfer", ar.ntransfer);
191  }
192  if (strchr(options, 't'))
193  settabsb(L, "istailcall", ar.istailcall);
194  if (strchr(options, 'L'))
195  treatstackoption(L, L1, "activelines");
196  if (strchr(options, 'f'))
197  treatstackoption(L, L1, "func");
198  return 1; /* return table */
199 }
200 
201 
202 static int db_getlocal (lua_State *L) {
203  int arg;
204  lua_State *L1 = getthread(L, &arg);
205  int nvar = (int)luaL_checkinteger(L, arg + 2); /* local-variable index */
206  if (lua_isfunction(L, arg + 1)) { /* function argument? */
207  lua_pushvalue(L, arg + 1); /* push function */
208  lua_pushstring(L, lua_getlocal(L, NULL, nvar)); /* push local name */
209  return 1; /* return only name (there is no value) */
210  }
211  else { /* stack-level argument */
212  lua_Debug ar;
213  const char *name;
214  int level = (int)luaL_checkinteger(L, arg + 1);
215  if (!lua_getstack(L1, level, &ar)) /* out of range? */
216  return luaL_argerror(L, arg+1, "level out of range");
217  checkstack(L, L1, 1);
218  name = lua_getlocal(L1, &ar, nvar);
219  if (name) {
220  lua_xmove(L1, L, 1); /* move local value */
221  lua_pushstring(L, name); /* push name */
222  lua_rotate(L, -2, 1); /* re-order */
223  return 2;
224  }
225  else {
226  luaL_pushfail(L); /* no name (nor value) */
227  return 1;
228  }
229  }
230 }
231 
232 
233 static int db_setlocal (lua_State *L) {
234  int arg;
235  const char *name;
236  lua_State *L1 = getthread(L, &arg);
237  lua_Debug ar;
238  int level = (int)luaL_checkinteger(L, arg + 1);
239  int nvar = (int)luaL_checkinteger(L, arg + 2);
240  if (!lua_getstack(L1, level, &ar)) /* out of range? */
241  return luaL_argerror(L, arg+1, "level out of range");
242  luaL_checkany(L, arg+3);
243  lua_settop(L, arg+3);
244  checkstack(L, L1, 1);
245  lua_xmove(L, L1, 1);
246  name = lua_setlocal(L1, &ar, nvar);
247  if (name == NULL)
248  lua_pop(L1, 1); /* pop value (if not popped by 'lua_setlocal') */
249  lua_pushstring(L, name);
250  return 1;
251 }
252 
253 
254 /*
255 ** get (if 'get' is true) or set an upvalue from a closure
256 */
257 static int auxupvalue (lua_State *L, int get) {
258  const char *name;
259  int n = (int)luaL_checkinteger(L, 2); /* upvalue index */
260  luaL_checktype(L, 1, LUA_TFUNCTION); /* closure */
261  name = get ? lua_getupvalue(L, 1, n) : lua_setupvalue(L, 1, n);
262  if (name == NULL) return 0;
263  lua_pushstring(L, name);
264  lua_insert(L, -(get+1)); /* no-op if get is false */
265  return get + 1;
266 }
267 
268 
269 static int db_getupvalue (lua_State *L) {
270  return auxupvalue(L, 1);
271 }
272 
273 
274 static int db_setupvalue (lua_State *L) {
275  luaL_checkany(L, 3);
276  return auxupvalue(L, 0);
277 }
278 
279 
280 /*
281 ** Check whether a given upvalue from a given closure exists and
282 ** returns its index
283 */
284 static int checkupval (lua_State *L, int argf, int argnup) {
285  int nup = (int)luaL_checkinteger(L, argnup); /* upvalue index */
286  luaL_checktype(L, argf, LUA_TFUNCTION); /* closure */
287  luaL_argcheck(L, (lua_getupvalue(L, argf, nup) != NULL), argnup,
288  "invalid upvalue index");
289  return nup;
290 }
291 
292 
293 static int db_upvalueid (lua_State *L) {
294  int n = checkupval(L, 1, 2);
296  return 1;
297 }
298 
299 
300 static int db_upvaluejoin (lua_State *L) {
301  int n1 = checkupval(L, 1, 2);
302  int n2 = checkupval(L, 3, 4);
303  luaL_argcheck(L, !lua_iscfunction(L, 1), 1, "Lua function expected");
304  luaL_argcheck(L, !lua_iscfunction(L, 3), 3, "Lua function expected");
305  lua_upvaluejoin(L, 1, n1, 3, n2);
306  return 0;
307 }
308 
309 
310 /*
311 ** Call hook function registered at hook table for the current
312 ** thread (if there is one)
313 */
314 static void hookf (lua_State *L, lua_Debug *ar) {
315  static const char *const hooknames[] =
316  {"call", "return", "line", "count", "tail call"};
318  lua_pushthread(L);
319  if (lua_rawget(L, -2) == LUA_TFUNCTION) { /* is there a hook function? */
320  lua_pushstring(L, hooknames[(int)ar->event]); /* push event name */
321  if (ar->currentline >= 0)
322  lua_pushinteger(L, ar->currentline); /* push current line */
323  else lua_pushnil(L);
324  lua_assert(lua_getinfo(L, "lS", ar));
325  lua_call(L, 2, 0); /* call hook function */
326  }
327 }
328 
329 
330 /*
331 ** Convert a string mask (for 'sethook') into a bit mask
332 */
333 static int makemask (const char *smask, int count) {
334  int mask = 0;
335  if (strchr(smask, 'c')) mask |= LUA_MASKCALL;
336  if (strchr(smask, 'r')) mask |= LUA_MASKRET;
337  if (strchr(smask, 'l')) mask |= LUA_MASKLINE;
338  if (count > 0) mask |= LUA_MASKCOUNT;
339  return mask;
340 }
341 
342 
343 /*
344 ** Convert a bit mask (for 'gethook') into a string mask
345 */
346 static char *unmakemask (int mask, char *smask) {
347  int i = 0;
348  if (mask & LUA_MASKCALL) smask[i++] = 'c';
349  if (mask & LUA_MASKRET) smask[i++] = 'r';
350  if (mask & LUA_MASKLINE) smask[i++] = 'l';
351  smask[i] = '\0';
352  return smask;
353 }
354 
355 
356 static int db_sethook (lua_State *L) {
357  int arg, mask, count;
358  lua_Hook func;
359  lua_State *L1 = getthread(L, &arg);
360  if (lua_isnoneornil(L, arg+1)) { /* no hook? */
361  lua_settop(L, arg+1);
362  func = NULL; mask = 0; count = 0; /* turn off hooks */
363  }
364  else {
365  const char *smask = luaL_checkstring(L, arg+2);
366  luaL_checktype(L, arg+1, LUA_TFUNCTION);
367  count = (int)luaL_optinteger(L, arg + 3, 0);
368  func = hookf; mask = makemask(smask, count);
369  }
371  /* table just created; initialize it */
372  lua_pushstring(L, "k");
373  lua_setfield(L, -2, "__mode");
374  lua_pushvalue(L, -1);
375  lua_setmetatable(L, -2); /* metatable(hooktable) = hooktable */
376  }
377  checkstack(L, L1, 1);
378  lua_pushthread(L1); lua_xmove(L1, L, 1); /* key (thread) */
379  lua_pushvalue(L, arg + 1); /* value (hook function) */
380  lua_rawset(L, -3); /* hooktable[L1] = new Lua hook */
381  lua_sethook(L1, func, mask, count);
382  return 0;
383 }
384 
385 
386 static int db_gethook (lua_State *L) {
387  int arg;
388  lua_State *L1 = getthread(L, &arg);
389  char buff[5];
390  int mask = lua_gethookmask(L1);
391  lua_Hook hook = lua_gethook(L1);
392  if (hook == NULL) { /* no hook? */
393  luaL_pushfail(L);
394  return 1;
395  }
396  else if (hook != hookf) /* external hook? */
397  lua_pushliteral(L, "external hook");
398  else { /* hook table must exist */
400  checkstack(L, L1, 1);
401  lua_pushthread(L1); lua_xmove(L1, L, 1);
402  lua_rawget(L, -2); /* 1st result = hooktable[L1] */
403  lua_remove(L, -2); /* remove hook table */
404  }
405  lua_pushstring(L, unmakemask(mask, buff)); /* 2nd result = mask */
406  lua_pushinteger(L, lua_gethookcount(L1)); /* 3rd result = count */
407  return 3;
408 }
409 
410 
411 static int db_debug (lua_State *L) {
412  for (;;) {
413  char buffer[250];
414  lua_writestringerror("%s", "lua_debug> ");
415  if (fgets(buffer, sizeof(buffer), stdin) == 0 ||
416  strcmp(buffer, "cont\n") == 0)
417  return 0;
418  if (luaL_loadbuffer(L, buffer, strlen(buffer), "=(debug command)") ||
419  lua_pcall(L, 0, 0, 0))
420  lua_writestringerror("%s\n", luaL_tolstring(L, -1, NULL));
421  lua_settop(L, 0); /* remove eventual returns */
422  }
423 }
424 
425 
426 static int db_traceback (lua_State *L) {
427  int arg;
428  lua_State *L1 = getthread(L, &arg);
429  const char *msg = lua_tostring(L, arg + 1);
430  if (msg == NULL && !lua_isnoneornil(L, arg + 1)) /* non-string 'msg'? */
431  lua_pushvalue(L, arg + 1); /* return it untouched */
432  else {
433  int level = (int)luaL_optinteger(L, arg + 2, (L == L1) ? 1 : 0);
434  luaL_traceback(L, L1, msg, level);
435  }
436  return 1;
437 }
438 
439 
440 static int db_setcstacklimit (lua_State *L) {
441  int limit = (int)luaL_checkinteger(L, 1);
442  int res = lua_setcstacklimit(L, limit);
443  if (res == 0)
444  lua_pushboolean(L, 0);
445  else
446  lua_pushinteger(L, res);
447  return 1;
448 }
449 
450 
451 static const luaL_Reg dblib[] = {
452  {"debug", db_debug},
453  {"getuservalue", db_getuservalue},
454  {"gethook", db_gethook},
455  {"getinfo", db_getinfo},
456  {"getlocal", db_getlocal},
457  {"getregistry", db_getregistry},
458  {"getmetatable", db_getmetatable},
459  {"getupvalue", db_getupvalue},
460  {"upvaluejoin", db_upvaluejoin},
461  {"upvalueid", db_upvalueid},
462  {"setuservalue", db_setuservalue},
463  {"sethook", db_sethook},
464  {"setlocal", db_setlocal},
465  {"setmetatable", db_setmetatable},
466  {"setupvalue", db_setupvalue},
467  {"traceback", db_traceback},
468  {"setcstacklimit", db_setcstacklimit},
469  {NULL, NULL}
470 };
471 
472 
474  luaL_newlib(L, dblib);
475  return 1;
476 }
477 
const char * what
Definition: lua.h:473
unsigned char nparams
Definition: lua.h:480
LUA_API const char * lua_getupvalue(lua_State *L, int funcindex, int n)
Definition: lapi.c:1352
#define lua_isnoneornil(L, n)
Definition: lua.h:379
Definition: lua.h:469
LUA_API void lua_xmove(lua_State *from, lua_State *to, int n)
Definition: lapi.c:120
static char * unmakemask(int mask, char *smask)
Definition: ldblib.c:346
LUA_API int lua_rawget(lua_State *L, int idx)
Definition: lapi.c:698
static const char *const HOOKKEY
Definition: ldblib.c:27
static int db_getuservalue(lua_State *L)
Definition: ldblib.c:65
LUA_API void lua_pushnil(lua_State *L)
Definition: lapi.c:473
#define luaL_pushfail(L)
Definition: lauxlib.h:157
#define LUA_TUSERDATA
Definition: lua.h:72
static int db_setuservalue(lua_State *L)
Definition: ldblib.c:77
static int db_setlocal(lua_State *L)
Definition: ldblib.c:233
LUA_API int lua_setmetatable(lua_State *L, int objindex)
Definition: lapi.c:901
LUAMOD_API int luaopen_debug(lua_State *L)
Definition: ldblib.c:473
unsigned char nups
Definition: lua.h:479
#define LUA_MASKRET
Definition: lua.h:440
#define LUA_MASKCOUNT
Definition: lua.h:442
const char * name
Definition: lua.h:471
LUA_API void lua_rawset(lua_State *L, int idx)
Definition: lapi.c:877
#define LUA_MASKCALL
Definition: lua.h:439
#define luaL_argexpected(L, cond, arg, tname)
Definition: lauxlib.h:135
static int auxupvalue(lua_State *L, int get)
Definition: ldblib.c:257
static void settabsi(lua_State *L, const char *k, int v)
Definition: ldblib.c:116
static int db_setcstacklimit(lua_State *L)
Definition: ldblib.c:440
LUA_API void lua_setfield(lua_State *L, int idx, const char *k)
Definition: lapi.c:837
#define lua_remove(L, idx)
Definition: lua.h:391
static int db_getinfo(lua_State *L)
Definition: ldblib.c:149
const char * source
Definition: lua.h:474
int event
Definition: lua.h:470
LUA_API int lua_setiuservalue(lua_State *L, int idx, int n)
Definition: lapi.c:941
LUA_API const char * lua_getlocal(lua_State *L, const lua_Debug *ar, int n)
Definition: ldebug.c:224
static int db_getregistry(lua_State *L)
Definition: ldblib.c:41
char short_src[LUA_IDSIZE]
Definition: lua.h:485
#define LUA_TFUNCTION
Definition: lua.h:71
const char * namewhat
Definition: lua.h:472
LUA_API const char * lua_pushstring(lua_State *L, const char *s)
Definition: lapi.c:514
static int db_debug(lua_State *L)
Definition: ldblib.c:411
size_t srclen
Definition: lua.h:475
static int makemask(const char *smask, int count)
Definition: ldblib.c:333
LUA_API void lua_sethook(lua_State *L, lua_Hook func, int mask, int count)
Definition: ldebug.c:135
#define lua_pop(L, n)
Definition: lua.h:364
#define luaL_loadbuffer(L, s, sz, n)
Definition: lauxlib.h:153
LUA_API void lua_pushvalue(lua_State *L, int idx)
Definition: lapi.c:246
LUA_API int lua_getinfo(lua_State *L, const char *what, lua_Debug *ar)
Definition: ldebug.c:386
int lastlinedefined
Definition: lua.h:478
static lua_State * getthread(lua_State *L, int *arg)
Definition: ldblib.c:94
LUA_API void lua_settop(lua_State *L, int idx)
Definition: lapi.c:173
LUA_API int lua_getmetatable(lua_State *L, int objindex)
Definition: lapi.c:741
LUA_API void lua_upvaluejoin(lua_State *L, int fidx1, int n1, int fidx2, int n2)
Definition: lapi.c:1415
#define lua_isthread(L, n)
Definition: lua.h:377
#define lua_pcall(L, n, r, f)
Definition: lua.h:287
LUA_API int lua_getstack(lua_State *L, int level, lua_Debug *ar)
Definition: ldebug.c:164
constexpr size_t count()
Definition: core.h:960
#define LUA_TNONE
Definition: lua.h:63
static const luaL_Reg dblib[]
Definition: ldblib.c:451
char istailcall
Definition: lua.h:482
LUA_API void * lua_upvalueid(lua_State *L, int fidx, int n)
Definition: lapi.c:1396
#define LUA_TNIL
Definition: lua.h:65
unsigned short ntransfer
Definition: lua.h:484
LUA_API void lua_pushboolean(lua_State *L, int b)
Definition: lapi.c:581
LUA_API int lua_iscfunction(lua_State *L, int idx)
Definition: lapi.c:273
static int db_setupvalue(lua_State *L)
Definition: ldblib.c:274
static int db_getlocal(lua_State *L)
Definition: ldblib.c:202
static void settabsb(lua_State *L, const char *k, int v)
Definition: ldblib.c:121
char isvararg
Definition: lua.h:481
LUA_API int lua_pushthread(lua_State *L)
Definition: lapi.c:600
LUA_API int lua_getiuservalue(lua_State *L, int idx, int n)
Definition: lapi.c:768
#define lua_newtable(L)
Definition: lua.h:366
LUA_API lua_State * lua_tothread(lua_State *L, int idx)
Definition: lapi.c:438
#define lua_pushliteral(L, s)
Definition: lua.h:381
LUALIB_API void luaL_checkany(lua_State *L, int arg)
Definition: lauxlib.c:396
LUA_API const char * lua_setlocal(lua_State *L, const lua_Debug *ar, int n)
Definition: ldebug.c:246
LUALIB_API const char * luaL_tolstring(lua_State *L, int idx, size_t *len)
Definition: lauxlib.c:861
static int db_setmetatable(lua_State *L)
Definition: ldblib.c:56
LUALIB_API void luaL_traceback(lua_State *L, lua_State *L1, const char *msg, int level)
Definition: lauxlib.c:131
#define lua_assert(c)
Definition: llimits.h:101
const char * name
static int db_gethook(lua_State *L)
Definition: ldblib.c:386
LUALIB_API lua_Integer luaL_checkinteger(lua_State *L, int arg)
Definition: lauxlib.c:442
detail::named_arg< Char, T > arg(const Char *name, const T &arg)
Definition: core.h:1656
static void settabss(lua_State *L, const char *k, const char *v)
Definition: ldblib.c:111
#define lua_isfunction(L, n)
Definition: lua.h:372
LUA_API int lua_type(lua_State *L, int idx)
Definition: lapi.c:260
LUALIB_API int luaL_argerror(lua_State *L, int arg, const char *extramsg)
Definition: lauxlib.c:175
#define LUAMOD_API
Definition: luaconf.h:301
LUALIB_API lua_Integer luaL_optinteger(lua_State *L, int arg, lua_Integer def)
Definition: lauxlib.c:452
#define lua_tostring(L, i)
Definition: lua.h:386
static void checkstack(lua_State *L, lua_State *L1, int n)
Definition: ldblib.c:35
LUALIB_API int luaL_error(lua_State *L, const char *fmt,...)
Definition: lauxlib.c:234
static int db_upvaluejoin(lua_State *L)
Definition: ldblib.c:300
#define luaL_newlib(L, l)
Definition: lauxlib.h:129
static void hookf(lua_State *L, lua_Debug *ar)
Definition: ldblib.c:314
#define lua_call(L, n, r)
Definition: lua.h:283
LUA_API void lua_rotate(lua_State *L, int idx, int n)
Definition: lapi.c:217
LUA_API int lua_gethookcount(lua_State *L)
Definition: ldebug.c:159
#define luaL_argcheck(L, cond, arg, extramsg)
Definition: lauxlib.h:132
LUA_API int lua_gethookmask(lua_State *L)
Definition: ldebug.c:154
static int db_upvalueid(lua_State *L)
Definition: ldblib.c:293
LUALIB_API int luaL_getsubtable(lua_State *L, int idx, const char *fname)
Definition: lauxlib.c:925
LUA_API void lua_pushinteger(lua_State *L, lua_Integer n)
Definition: lapi.c:489
#define LUA_REGISTRYINDEX
Definition: lua.h:44
LUA_API void lua_pushlightuserdata(lua_State *L, void *p)
Definition: lapi.c:592
LUALIB_API void luaL_checktype(lua_State *L, int arg, int t)
Definition: lauxlib.c:390
void(* lua_Hook)(lua_State *L, lua_Debug *ar)
Definition: lua.h:448
#define lua_writestringerror(s, p)
Definition: lauxlib.h:245
LUA_API const char * lua_pushfstring(lua_State *L, const char *fmt,...)
Definition: lapi.c:542
LUA_API const char * lua_setupvalue(lua_State *L, int funcindex, int n)
Definition: lapi.c:1366
#define lua_insert(L, idx)
Definition: lua.h:389
LUA_API lua_Hook lua_gethook(lua_State *L)
Definition: ldebug.c:149
LUA_API const char * lua_pushlstring(lua_State *L, const char *s, size_t len)
Definition: lapi.c:502
int currentline
Definition: lua.h:476
LUA_API int lua_setcstacklimit(lua_State *L, unsigned int limit)
Definition: lstate.c:99
LUA_API int lua_getfield(lua_State *L, int idx, const char *k)
Definition: lapi.c:655
static int db_sethook(lua_State *L)
Definition: ldblib.c:356
#define LUA_TTABLE
Definition: lua.h:70
unsigned short ftransfer
Definition: lua.h:483
#define luaL_optstring(L, n, d)
Definition: lauxlib.h:139
static int checkupval(lua_State *L, int argf, int argnup)
Definition: ldblib.c:284
#define LUA_MASKLINE
Definition: lua.h:441
static int db_getmetatable(lua_State *L)
Definition: ldblib.c:47
static void treatstackoption(lua_State *L, lua_State *L1, const char *fname)
Definition: ldblib.c:134
static int db_traceback(lua_State *L)
Definition: ldblib.c:426
LUA_API int lua_checkstack(lua_State *L, int n)
Definition: lapi.c:98
static int db_getupvalue(lua_State *L)
Definition: ldblib.c:269
int linedefined
Definition: lua.h:477
struct Options options
#define luaL_checkstring(L, n)
Definition: lauxlib.h:138


plotjuggler
Author(s): Davide Faconti
autogenerated on Sun Dec 6 2020 03:48:09