The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
lbaselib.cpp
Go to the documentation of this file.
1 /*
2 ** Basic library
3 ** See Copyright Notice in lua.h
4 */
5 
6 
7 
8 #include <ctype.h>
9 #include <stdio.h>
10 #include <stdlib.h>
11 #include <string.h>
12 
13 #define lbaselib_c
14 #define LUA_LIB
15 
16 #include "lua.h"
17 
18 #include "lauxlib.h"
19 #include "lualib.h"
20 
21 
22 static int luaB_print (lua_State *L) {
23  int n = lua_gettop(L); /* number of arguments */
24  int i;
25  lua_getglobal(L, "tostring");
26  for (i=1; i<=n; i++) {
27  const char *s;
28  size_t l;
29  lua_pushvalue(L, -1); /* function to be called */
30  lua_pushvalue(L, i); /* value to print */
31  lua_call(L, 1, 1);
32  s = lua_tolstring(L, -1, &l); /* get result */
33  if (s == NULL)
34  return luaL_error(L,
35  LUA_QL("tostring") " must return a string to " LUA_QL("print"));
36  if (i>1) luai_writestring("\t", 1);
37  luai_writestring(s, l);
38  lua_pop(L, 1); /* pop result */
39  }
40  luai_writeline();
41  return 0;
42 }
43 
44 
45 #define SPACECHARS " \f\n\r\t\v"
46 
47 static int luaB_tonumber (lua_State *L) {
48  if (lua_isnoneornil(L, 2)) { /* standard conversion */
49  int isnum;
50  lua_Number n = lua_tonumberx(L, 1, &isnum);
51  if (isnum) {
52  lua_pushnumber(L, n);
53  return 1;
54  } /* else not a number; must be something */
55  luaL_checkany(L, 1);
56  }
57  else {
58  size_t l;
59  const char *s = luaL_checklstring(L, 1, &l);
60  const char *e = s + l; /* end point for 's' */
61  int base = luaL_checkint(L, 2);
62  int neg = 0;
63  luaL_argcheck(L, 2 <= base && base <= 36, 2, "base out of range");
64  s += strspn(s, SPACECHARS); /* skip initial spaces */
65  if (*s == '-') { s++; neg = 1; } /* handle signal */
66  else if (*s == '+') s++;
67  if (isalnum((unsigned char)*s)) {
68  lua_Number n = 0;
69  do {
70  int digit = (isdigit((unsigned char)*s)) ? *s - '0'
71  : toupper((unsigned char)*s) - 'A' + 10;
72  if (digit >= base) break; /* invalid numeral; force a fail */
73  n = n * (lua_Number)base + (lua_Number)digit;
74  s++;
75  } while (isalnum((unsigned char)*s));
76  s += strspn(s, SPACECHARS); /* skip trailing spaces */
77  if (s == e) { /* no invalid trailing characters? */
78  lua_pushnumber(L, (neg) ? -n : n);
79  return 1;
80  } /* else not a number */
81  } /* else not a number */
82  }
83  lua_pushnil(L); /* not a number */
84  return 1;
85 }
86 
87 
88 static int luaB_error (lua_State *L) {
89  int level = luaL_optint(L, 2, 1);
90  lua_settop(L, 1);
91  if (lua_isstring(L, 1) && level > 0) { /* add extra information? */
92  luaL_where(L, level);
93  lua_pushvalue(L, 1);
94  lua_concat(L, 2);
95  }
96  return lua_error(L);
97 }
98 
99 
100 static int luaB_getmetatable (lua_State *L) {
101  luaL_checkany(L, 1);
102  if (!lua_getmetatable(L, 1)) {
103  lua_pushnil(L);
104  return 1; /* no metatable */
105  }
106  luaL_getmetafield(L, 1, "__metatable");
107  return 1; /* returns either __metatable field (if present) or metatable */
108 }
109 
110 
111 static int luaB_setmetatable (lua_State *L) {
112  int t = lua_type(L, 2);
113  luaL_checktype(L, 1, LUA_TTABLE);
114  luaL_argcheck(L, t == LUA_TNIL || t == LUA_TTABLE, 2,
115  "nil or table expected");
116  if (luaL_getmetafield(L, 1, "__metatable"))
117  return luaL_error(L, "cannot change a protected metatable");
118  lua_settop(L, 2);
119  lua_setmetatable(L, 1);
120  return 1;
121 }
122 
123 
124 static int luaB_rawequal (lua_State *L) {
125  luaL_checkany(L, 1);
126  luaL_checkany(L, 2);
127  lua_pushboolean(L, lua_rawequal(L, 1, 2));
128  return 1;
129 }
130 
131 
132 static int luaB_rawlen (lua_State *L) {
133  int t = lua_type(L, 1);
134  luaL_argcheck(L, t == LUA_TTABLE || t == LUA_TSTRING, 1,
135  "table or string expected");
136  lua_pushinteger(L, lua_rawlen(L, 1));
137  return 1;
138 }
139 
140 
141 static int luaB_rawget (lua_State *L) {
142  luaL_checktype(L, 1, LUA_TTABLE);
143  luaL_checkany(L, 2);
144  lua_settop(L, 2);
145  lua_rawget(L, 1);
146  return 1;
147 }
148 
149 static int luaB_rawset (lua_State *L) {
150  luaL_checktype(L, 1, LUA_TTABLE);
151  luaL_checkany(L, 2);
152  luaL_checkany(L, 3);
153  lua_settop(L, 3);
154  lua_rawset(L, 1);
155  return 1;
156 }
157 
158 
160  static const char *const opts[] = {"stop", "restart", "collect",
161  "count", "step", "setpause", "setstepmul",
162  "setmajorinc", "isrunning", "generational", "incremental", NULL};
163  static const int optsnum[] = {LUA_GCSTOP, LUA_GCRESTART, LUA_GCCOLLECT,
166  int o = optsnum[luaL_checkoption(L, 1, "collect", opts)];
167  int ex = luaL_optint(L, 2, 0);
168  int res = lua_gc(L, o, ex);
169  switch (o) {
170  case LUA_GCCOUNT: {
171  int b = lua_gc(L, LUA_GCCOUNTB, 0);
172  lua_pushnumber(L, res + ((lua_Number)b/1024));
173  lua_pushinteger(L, b);
174  return 2;
175  }
176  case LUA_GCSTEP: case LUA_GCISRUNNING: {
177  lua_pushboolean(L, res);
178  return 1;
179  }
180  default: {
181  lua_pushinteger(L, res);
182  return 1;
183  }
184  }
185 }
186 
187 
188 static int luaB_type (lua_State *L) {
189  luaL_checkany(L, 1);
190  lua_pushstring(L, luaL_typename(L, 1));
191  return 1;
192 }
193 
194 
195 static int pairsmeta (lua_State *L, const char *method, int iszero,
196  lua_CFunction iter) {
197  if (!luaL_getmetafield(L, 1, method)) { /* no metamethod? */
198  luaL_checktype(L, 1, LUA_TTABLE); /* argument must be a table */
199  lua_pushcfunction(L, iter); /* will return generator, */
200  lua_pushvalue(L, 1); /* state, */
201  if (iszero) lua_pushinteger(L, 0); /* and initial value */
202  else lua_pushnil(L);
203  }
204  else {
205  lua_pushvalue(L, 1); /* argument 'self' to metamethod */
206  lua_call(L, 1, 3); /* get 3 values from metamethod */
207  }
208  return 3;
209 }
210 
211 
212 static int luaB_next (lua_State *L) {
213  luaL_checktype(L, 1, LUA_TTABLE);
214  lua_settop(L, 2); /* create a 2nd argument if there isn't one */
215  if (lua_next(L, 1))
216  return 2;
217  else {
218  lua_pushnil(L);
219  return 1;
220  }
221 }
222 
223 
224 static int luaB_pairs (lua_State *L) {
225  return pairsmeta(L, "__pairs", 0, luaB_next);
226 }
227 
228 
229 static int ipairsaux (lua_State *L) {
230  int i = luaL_checkint(L, 2);
231  luaL_checktype(L, 1, LUA_TTABLE);
232  i++; /* next value */
233  lua_pushinteger(L, i);
234  lua_rawgeti(L, 1, i);
235  return (lua_isnil(L, -1)) ? 1 : 2;
236 }
237 
238 
239 static int luaB_ipairs (lua_State *L) {
240  return pairsmeta(L, "__ipairs", 1, ipairsaux);
241 }
242 
243 
244 static int load_aux (lua_State *L, int status, int envidx) {
245  if (status == LUA_OK) {
246  if (envidx != 0) { /* 'env' parameter? */
247  lua_pushvalue(L, envidx); /* environment for loaded function */
248  if (!lua_setupvalue(L, -2, 1)) /* set it as 1st upvalue */
249  lua_pop(L, 1); /* remove 'env' if not used by previous call */
250  }
251  return 1;
252  }
253  else { /* error (message is on top of the stack) */
254  lua_pushnil(L);
255  lua_insert(L, -2); /* put before error message */
256  return 2; /* return nil plus error message */
257  }
258 }
259 
260 
261 static int luaB_loadfile (lua_State *L) {
262  const char *fname = luaL_optstring(L, 1, NULL);
263  const char *mode = luaL_optstring(L, 2, NULL);
264  int env = (!lua_isnone(L, 3) ? 3 : 0); /* 'env' index or 0 if no 'env' */
265  int status = luaL_loadfilex(L, fname, mode);
266  return load_aux(L, status, env);
267 }
268 
269 
270 /*
271 ** {======================================================
272 ** Generic Read function
273 ** =======================================================
274 */
275 
276 
277 /*
278 ** reserved slot, above all arguments, to hold a copy of the returned
279 ** string to avoid it being collected while parsed. 'load' has four
280 ** optional arguments (chunk, source name, mode, and environment).
281 */
282 #define RESERVEDSLOT 5
283 
284 
285 /*
286 ** Reader for generic `load' function: `lua_load' uses the
287 ** stack for internal stuff, so the reader cannot change the
288 ** stack top. Instead, it keeps its resulting string in a
289 ** reserved slot inside the stack.
290 */
291 static const char *generic_reader (lua_State *L, void *ud, size_t *size) {
292  (void)(ud); /* not used */
293  luaL_checkstack(L, 2, "too many nested functions");
294  lua_pushvalue(L, 1); /* get function */
295  lua_call(L, 0, 1); /* call it */
296  if (lua_isnil(L, -1)) {
297  lua_pop(L, 1); /* pop result */
298  *size = 0;
299  return NULL;
300  }
301  else if (!lua_isstring(L, -1))
302  luaL_error(L, "reader function must return a string");
303  lua_replace(L, RESERVEDSLOT); /* save string in reserved slot */
304  return lua_tolstring(L, RESERVEDSLOT, size);
305 }
306 
307 
308 static int luaB_load (lua_State *L) {
309  int status;
310  size_t l;
311  const char *s = lua_tolstring(L, 1, &l);
312  const char *mode = luaL_optstring(L, 3, "bt");
313  int env = (!lua_isnone(L, 4) ? 4 : 0); /* 'env' index or 0 if no 'env' */
314  if (s != NULL) { /* loading a string? */
315  const char *chunkname = luaL_optstring(L, 2, s);
316  status = luaL_loadbufferx(L, s, l, chunkname, mode);
317  }
318  else { /* loading from a reader function */
319  const char *chunkname = luaL_optstring(L, 2, "=(load)");
321  lua_settop(L, RESERVEDSLOT); /* create reserved slot */
322  status = lua_load(L, generic_reader, NULL, chunkname, mode);
323  }
324  return load_aux(L, status, env);
325 }
326 
327 /* }====================================================== */
328 
329 
330 static int dofilecont (lua_State *L) {
331  return lua_gettop(L) - 1;
332 }
333 
334 
335 static int luaB_dofile (lua_State *L) {
336  const char *fname = luaL_optstring(L, 1, NULL);
337  lua_settop(L, 1);
338  if (luaL_loadfile(L, fname) != LUA_OK)
339  return lua_error(L);
340  lua_callk(L, 0, LUA_MULTRET, 0, dofilecont);
341  return dofilecont(L);
342 }
343 
344 
345 static int luaB_assert (lua_State *L) {
346  if (!lua_toboolean(L, 1))
347  return luaL_error(L, "%s", luaL_optstring(L, 2, "assertion failed!"));
348  return lua_gettop(L);
349 }
350 
351 
352 static int luaB_select (lua_State *L) {
353  int n = lua_gettop(L);
354  if (lua_type(L, 1) == LUA_TSTRING && *lua_tostring(L, 1) == '#') {
355  lua_pushinteger(L, n-1);
356  return 1;
357  }
358  else {
359  int i = luaL_checkint(L, 1);
360  if (i < 0) i = n + i;
361  else if (i > n) i = n;
362  luaL_argcheck(L, 1 <= i, 1, "index out of range");
363  return n - i;
364  }
365 }
366 
367 
368 static int finishpcall (lua_State *L, int status) {
369  if (!lua_checkstack(L, 1)) { /* no space for extra boolean? */
370  lua_settop(L, 0); /* create space for return values */
371  lua_pushboolean(L, 0);
372  lua_pushstring(L, "stack overflow");
373  return 2; /* return false, msg */
374  }
375  lua_pushboolean(L, status); /* first result (status) */
376  lua_replace(L, 1); /* put first result in first slot */
377  return lua_gettop(L);
378 }
379 
380 
381 static int pcallcont (lua_State *L) {
382  int status = lua_getctx(L, NULL);
383  return finishpcall(L, (status == LUA_YIELD));
384 }
385 
386 
387 static int luaB_pcall (lua_State *L) {
388  int status;
389  luaL_checkany(L, 1);
390  lua_pushnil(L);
391  lua_insert(L, 1); /* create space for status result */
392  status = lua_pcallk(L, lua_gettop(L) - 2, LUA_MULTRET, 0, 0, pcallcont);
393  return finishpcall(L, (status == LUA_OK));
394 }
395 
396 
397 static int luaB_xpcall (lua_State *L) {
398  int status;
399  int n = lua_gettop(L);
400  luaL_argcheck(L, n >= 2, 2, "value expected");
401  lua_pushvalue(L, 1); /* exchange function... */
402  lua_copy(L, 2, 1); /* ...and error handler */
403  lua_replace(L, 2);
404  status = lua_pcallk(L, n - 2, LUA_MULTRET, 1, 0, pcallcont);
405  return finishpcall(L, (status == LUA_OK));
406 }
407 
408 
409 static int luaB_tostring (lua_State *L) {
410  luaL_checkany(L, 1);
411  luaL_tolstring(L, 1, NULL);
412  return 1;
413 }
414 
415 
416 static const luaL_Reg base_funcs[] = {
417  {"assert", luaB_assert},
418  {"collectgarbage", luaB_collectgarbage},
419  {"dofile", luaB_dofile},
420  {"error", luaB_error},
421  {"getmetatable", luaB_getmetatable},
422  {"ipairs", luaB_ipairs},
423  {"loadfile", luaB_loadfile},
424  {"load", luaB_load},
425 #if defined(LUA_COMPAT_LOADSTRING)
426  {"loadstring", luaB_load},
427 #endif
428  {"next", luaB_next},
429  {"pairs", luaB_pairs},
430  {"pcall", luaB_pcall},
431  {"print", luaB_print},
432  {"rawequal", luaB_rawequal},
433  {"rawlen", luaB_rawlen},
434  {"rawget", luaB_rawget},
435  {"rawset", luaB_rawset},
436  {"select", luaB_select},
437  {"setmetatable", luaB_setmetatable},
438  {"tonumber", luaB_tonumber},
439  {"tostring", luaB_tostring},
440  {"type", luaB_type},
441  {"xpcall", luaB_xpcall},
442  {NULL, NULL}
443 };
444 
445 
447  /* set global _G */
450  lua_setfield(L, -2, "_G");
451  /* open lib into global table */
452  luaL_setfuncs(L, base_funcs, 0);
454  lua_setfield(L, -2, "_VERSION"); /* set global _VERSION */
455  return 1;
456 }
457 
LUA_API void lua_rawgeti(lua_State *L, int idx, int n)
Definition: lapi.cpp:643
#define lua_isnoneornil(L, n)
Definition: lua.h:337
#define lua_pushcfunction(L, f)
Definition: lua.h:328
LUA_API void lua_replace(lua_State *L, int idx)
Definition: lapi.cpp:211
#define LUA_GCSETSTEPMUL
Definition: lua.h:287
static int luaB_select(lua_State *L)
Definition: lbaselib.cpp:352
GLvoid **typedef void(GLAPIENTRY *PFNGLGETVERTEXATTRIBDVPROC)(GLuint
Definition: glew.h:1806
LUALIB_API const char * luaL_tolstring(lua_State *L, int idx, size_t *len)
Definition: lauxlib.cpp:739
LUA_API void lua_settop(lua_State *L, int idx)
Definition: lapi.cpp:159
#define lua_isnone(L, n)
Definition: lua.h:336
LUA_API int lua_type(lua_State *L, int idx)
Definition: lapi.cpp:243
GLint level
Definition: glew.h:1220
static int luaB_pcall(lua_State *L)
Definition: lbaselib.cpp:387
LUA_API void lua_pushboolean(lua_State *L, int b)
Definition: lapi.cpp:571
#define LUA_MULTRET
Definition: lua.h:33
LUALIB_API void luaL_checktype(lua_State *L, int narg, int t)
Definition: lauxlib.cpp:347
LUA_API void lua_getglobal(lua_State *L, const char *var)
Definition: lapi.cpp:602
#define LUA_GCSTEP
Definition: lua.h:285
LUALIB_API int luaL_getmetafield(lua_State *L, int obj, const char *event)
Definition: lauxlib.cpp:701
LUA_API int lua_gettop(lua_State *L)
Definition: lapi.cpp:154
static int luaB_next(lua_State *L)
Definition: lbaselib.cpp:212
static int pairsmeta(lua_State *L, const char *method, int iszero, lua_CFunction iter)
Definition: lbaselib.cpp:195
LUALIB_API int luaL_loadfilex(lua_State *L, const char *filename, const char *mode)
Definition: lauxlib.cpp:632
#define luaL_typename(L, i)
Definition: lauxlib.h:122
LUALIB_API void luaL_checkstack(lua_State *L, int space, const char *msg)
Definition: lauxlib.cpp:335
#define LUA_TFUNCTION
Definition: lua.h:83
static int luaB_xpcall(lua_State *L)
Definition: lbaselib.cpp:397
GLenum mode
Definition: glew.h:2390
#define luaL_argcheck(L, cond, numarg, extramsg)
Definition: lauxlib.h:113
GLdouble GLdouble t
Definition: glew.h:1366
static int luaB_ipairs(lua_State *L)
Definition: lbaselib.cpp:239
static int luaB_print(lua_State *L)
Definition: lbaselib.cpp:22
LUAMOD_API int luaopen_base(lua_State *L)
Definition: lbaselib.cpp:446
LUA_API void lua_callk(lua_State *L, int nargs, int nresults, int ctx, lua_CFunction k)
Definition: lapi.cpp:883
int(* lua_CFunction)(lua_State *L)
Definition: lua.h:55
#define lua_pop(L, n)
Definition: lua.h:322
GLdouble l
Definition: glew.h:6966
#define luaL_loadfile(L, f)
Definition: lauxlib.h:78
GLdouble GLdouble GLdouble b
Definition: glew.h:6966
LUA_API int lua_gc(lua_State *L, int what, int data)
Definition: lapi.cpp:1015
#define LUA_GCSTOP
Definition: lua.h:280
static int luaB_pairs(lua_State *L)
Definition: lbaselib.cpp:224
#define LUA_TSTRING
Definition: lua.h:81
static int luaB_dofile(lua_State *L)
Definition: lbaselib.cpp:335
#define LUA_GCSETMAJORINC
Definition: lua.h:288
#define LUA_GCISRUNNING
Definition: lua.h:289
LUA_API int lua_isstring(lua_State *L, int idx)
Definition: lapi.cpp:268
LUALIB_API int luaL_checkoption(lua_State *L, int narg, const char *def, const char *const lst[])
Definition: lauxlib.cpp:322
LUA_API int lua_rawequal(lua_State *L, int index1, int index2)
Definition: lapi.cpp:280
#define LUA_YIELD
Definition: lua.h:45
#define LUA_QL(x)
Definition: luaconf.h:198
LUALIB_API int luaL_loadbufferx(lua_State *L, const char *buff, size_t size, const char *name, const char *mode)
Definition: lauxlib.cpp:684
#define LUA_TNIL
Definition: lua.h:77
LUA_API int lua_toboolean(lua_State *L, int idx)
Definition: lapi.cpp:377
#define lua_pushglobaltable(L)
Definition: lua.h:342
LUALIB_API void luaL_where(lua_State *L, int level)
Definition: lauxlib.cpp:185
static int pcallcont(lua_State *L)
Definition: lbaselib.cpp:381
LUA_API int lua_getmetatable(lua_State *L, int objindex)
Definition: lapi.cpp:680
static int luaB_tonumber(lua_State *L)
Definition: lbaselib.cpp:47
LUA_API int lua_setmetatable(lua_State *L, int objindex)
Definition: lapi.cpp:806
#define RESERVEDSLOT
Definition: lbaselib.cpp:282
static int luaB_load(lua_State *L)
Definition: lbaselib.cpp:308
LUA_API const char * lua_tolstring(lua_State *L, int idx, size_t *len)
Definition: lapi.cpp:383
static const luaL_Reg base_funcs[]
Definition: lbaselib.cpp:416
static int luaB_setmetatable(lua_State *L)
Definition: lbaselib.cpp:111
LUA_API lua_Number lua_tonumberx(lua_State *L, int idx, int *isnum)
Definition: lapi.cpp:329
LUA_API void lua_pushnil(lua_State *L)
Definition: lapi.cpp:459
LUA_API const char * lua_setupvalue(lua_State *L, int funcindex, int n)
Definition: lapi.cpp:1221
LUA_API void lua_pushnumber(lua_State *L, lua_Number n)
Definition: lapi.cpp:467
LUALIB_API const char * luaL_checklstring(lua_State *L, int narg, size_t *len)
Definition: lauxlib.cpp:359
#define lua_pushliteral(L, s)
Definition: lua.h:339
static int luaB_rawequal(lua_State *L)
Definition: lbaselib.cpp:124
static int luaB_getmetatable(lua_State *L)
Definition: lbaselib.cpp:100
static int luaB_assert(lua_State *L)
Definition: lbaselib.cpp:345
static int luaB_rawlen(lua_State *L)
Definition: lbaselib.cpp:132
GLuint res
Definition: glew.h:9258
#define lua_isnil(L, n)
Definition: lua.h:333
LUA_API int lua_pcallk(lua_State *L, int nargs, int nresults, int errfunc, int ctx, lua_CFunction k)
Definition: lapi.cpp:922
LUA_API void lua_rawset(lua_State *L, int idx)
Definition: lapi.cpp:764
static int luaB_collectgarbage(lua_State *L)
Definition: lbaselib.cpp:159
#define LUA_GCCOLLECT
Definition: lua.h:282
static int dofilecont(lua_State *L)
Definition: lbaselib.cpp:330
#define LUA_GCCOUNT
Definition: lua.h:283
#define SPACECHARS
Definition: lbaselib.cpp:45
#define LUAMOD_API
Definition: luaconf.h:163
#define LUA_GCINC
Definition: lua.h:291
LUA_API int lua_load(lua_State *L, lua_Reader reader, void *data, const char *chunkname, const char *mode)
Definition: lapi.cpp:967
size_t i
Definition: function.cpp:1057
#define lua_tostring(L, i)
Definition: lua.h:345
LUA_API void lua_insert(lua_State *L, int idx)
Definition: lapi.cpp:187
LUA_API void lua_pushvalue(lua_State *L, int idx)
Definition: lapi.cpp:229
static int luaB_tostring(lua_State *L)
Definition: lbaselib.cpp:409
#define lua_call(L, n, r)
Definition: lua.h:252
LUALIB_API int luaL_error(lua_State *L, const char *fmt,...)
Definition: lauxlib.cpp:198
static int load_aux(lua_State *L, int status, int envidx)
Definition: lbaselib.cpp:244
LUA_API size_t lua_rawlen(lua_State *L, int idx)
Definition: lapi.cpp:401
static int luaB_rawget(lua_State *L)
Definition: lbaselib.cpp:141
GLsizeiptr size
Definition: glew.h:1649
#define LUA_GCGEN
Definition: lua.h:290
#define LUA_GCSETPAUSE
Definition: lua.h:286
static int ipairsaux(lua_State *L)
Definition: lbaselib.cpp:229
GLclampd n
Definition: glew.h:5903
#define luaL_checkint(L, n)
Definition: lauxlib.h:117
LUA_API int lua_error(lua_State *L)
Definition: lapi.cpp:1099
#define luaL_optint(L, n, d)
Definition: lauxlib.h:118
#define LUA_GCCOUNTB
Definition: lua.h:284
#define LUA_OK
Definition: lua.h:44
LUA_API void lua_concat(lua_State *L, int n)
Definition: lapi.cpp:1125
LUALIB_API void luaL_checkany(lua_State *L, int narg)
Definition: lauxlib.cpp:353
static int luaB_type(lua_State *L)
Definition: lbaselib.cpp:188
LUA_API int lua_checkstack(lua_State *L, int size)
Definition: lapi.cpp:86
static const char * generic_reader(lua_State *L, void *ud, size_t *size)
Definition: lbaselib.cpp:291
#define LUA_GCRESTART
Definition: lua.h:281
#define e
LUA_API void lua_copy(lua_State *L, int fromidx, int toidx)
Definition: lapi.cpp:220
LUA_API int lua_getctx(lua_State *L, int *ctx)
Definition: lapi.cpp:874
static int finishpcall(lua_State *L, int status)
Definition: lbaselib.cpp:368
LUALIB_API void luaL_setfuncs(lua_State *L, const luaL_Reg *l, int nup)
Definition: lauxlib.cpp:850
static int luaB_loadfile(lua_State *L)
Definition: lbaselib.cpp:261
static int luaB_error(lua_State *L)
Definition: lbaselib.cpp:88
GLdouble s
Definition: glew.h:1358
#define LUA_TTABLE
Definition: lua.h:82
LUA_API void lua_pushinteger(lua_State *L, lua_Integer n)
Definition: lapi.cpp:477
#define luaL_optstring(L, n, d)
Definition: lauxlib.h:116
LUA_API void lua_rawget(lua_State *L, int idx)
Definition: lapi.cpp:633
LUA_NUMBER lua_Number
Definition: lua.h:102
LUA_API const char * lua_pushstring(lua_State *L, const char *s)
Definition: lapi.cpp:507
LUA_API void lua_setfield(lua_State *L, int idx, const char *k)
Definition: lapi.cpp:752
#define LUA_VERSION
Definition: lua.h:23
LUA_API int lua_next(lua_State *L, int idx)
Definition: lapi.cpp:1108
static int luaB_rawset(lua_State *L)
Definition: lbaselib.cpp:149