Linux multi-monitor fullscreen support
[ryzomcore.git] / ryzom / client / src / interface_v3 / lua_dll.h
blobc405f41007fd3ff139ee950be5feb2ba3ee8b9a2
1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
19 ** Lua - An Extensible Extension Language
20 ** Tecgraf: Computer Graphics Technology Group, PUC-Rio, Brazil
21 ** http://www.lua.org mailto:info@lua.org
22 ** See Copyright Notice at the end of this file
26 #ifndef lua_h
27 #define lua_h
30 extern "C"
33 #include <stdarg.h>
34 #include <stddef.h>
35 #include <stdio.h>
38 #define LUA_VERSION "Lua 5.0.2"
39 #define LUA_COPYRIGHT "Copyright (C) 1994-2004 Tecgraf, PUC-Rio"
40 #define LUA_AUTHORS "R. Ierusalimschy, L. H. de Figueiredo & W. Celes"
44 /* option for multiple returns in `lua_pcall' and `lua_call' */
45 #define LUA_MULTRET (-1)
49 ** pseudo-indices
51 #define LUA_REGISTRYINDEX (-10000)
52 #define LUA_GLOBALSINDEX (-10001)
53 #define lua_upvalueindex(i) (LUA_GLOBALSINDEX-(i))
56 /* error codes for `lua_load' and `lua_pcall' */
57 #define LUA_ERRRUN 1
58 #define LUA_ERRFILE 2
59 #define LUA_ERRSYNTAX 3
60 #define LUA_ERRMEM 4
61 #define LUA_ERRERR 5
64 typedef struct lua_State lua_State;
66 typedef int (*lua_CFunction) (lua_State *L);
70 ** functions that read/write blocks when loading/dumping Lua chunks
72 typedef const char * (*lua_Chunkreader) (lua_State *L, void *ud, size_t *sz);
74 typedef int (*lua_Chunkwriter) (lua_State *L, const void* p,
75 size_t sz, void* ud);
79 ** basic types
81 #define LUA_TNONE (-1)
83 #define LUA_TNIL 0
84 #define LUA_TBOOLEAN 1
85 #define LUA_TLIGHTUSERDATA 2
86 #define LUA_TNUMBER 3
87 #define LUA_TSTRING 4
88 #define LUA_TTABLE 5
89 #define LUA_TFUNCTION 6
90 #define LUA_TUSERDATA 7
91 #define LUA_TTHREAD 8
94 /* minimum Lua stack available to a C function */
95 #define LUA_MINSTACK 20
99 ** generic extra include file
101 #ifdef LUA_USER_H
102 #include LUA_USER_H
103 #endif
106 /* type of numbers in Lua */
107 #ifndef LUA_NUMBER
108 typedef double lua_Number;
109 #else
110 typedef LUA_NUMBER lua_Number;
111 #endif
114 /* mark for all API functions */
115 #ifndef LUA_API
116 #define LUA_API extern
117 #endif
121 ** state manipulation
123 LUA_API lua_State *(*lua_open) (void);
124 LUA_API void (*lua_close) (lua_State *L);
125 LUA_API lua_State *(*lua_newthread) (lua_State *L);
127 LUA_API lua_CFunction (*lua_atpanic) (lua_State *L, lua_CFunction panicf);
131 ** basic stack manipulation
133 LUA_API int (*lua_gettop) (lua_State *L);
134 LUA_API void (*lua_settop) (lua_State *L, int idx);
135 LUA_API void (*lua_pushvalue) (lua_State *L, int idx);
136 LUA_API void (*lua_remove) (lua_State *L, int idx);
137 LUA_API void (*lua_insert )(lua_State *L, int idx);
138 LUA_API void (*lua_replace) (lua_State *L, int idx);
139 LUA_API int (*lua_checkstack) (lua_State *L, int sz);
141 LUA_API void (*lua_xmove) (lua_State *from, lua_State *to, int n);
145 ** access functions (stack -> C)
148 LUA_API int (*lua_isnumber) (lua_State *L, int idx);
149 LUA_API int (*lua_isstring) (lua_State *L, int idx);
150 LUA_API int (*lua_iscfunction) (lua_State *L, int idx);
151 LUA_API int (*lua_isuserdata) (lua_State *L, int idx);
152 LUA_API int (*lua_type) (lua_State *L, int idx);
153 LUA_API const char *(*lua_typename) (lua_State *L, int tp);
155 LUA_API int (*lua_equal) (lua_State *L, int idx1, int idx2);
156 LUA_API int (*lua_rawequal) (lua_State *L, int idx1, int idx2);
157 LUA_API int (*lua_lessthan) (lua_State *L, int idx1, int idx2);
159 LUA_API lua_Number (*lua_tonumber) (lua_State *L, int idx);
160 LUA_API int (*lua_toboolean) (lua_State *L, int idx);
161 LUA_API const char *(*lua_tostring) (lua_State *L, int idx);
162 LUA_API size_t (*lua_strlen) (lua_State *L, int idx);
163 LUA_API lua_CFunction (*lua_tocfunction) (lua_State *L, int idx);
164 LUA_API void *(*lua_touserdata) (lua_State *L, int idx);
165 LUA_API lua_State *(*lua_tothread) (lua_State *L, int idx);
166 LUA_API const void *(*lua_topointer) (lua_State *L, int idx);
170 ** push functions (C -> stack)
172 LUA_API void (*lua_pushnil) (lua_State *L);
173 LUA_API void (*lua_pushnumber) (lua_State *L, lua_Number n);
174 LUA_API void (*lua_pushlstring) (lua_State *L, const char *s, size_t l);
175 LUA_API void (*lua_pushstring) (lua_State *L, const char *s);
176 LUA_API const char *(*lua_pushvfstring) (lua_State *L, const char *fmt, ...);
177 LUA_API const char *(*lua_pushfstring) (lua_State *L, const char *fmt, ...);
178 LUA_API void (*lua_pushcclosure) (lua_State *L, lua_CFunction fn, int n);
179 LUA_API void (*lua_pushboolean) (lua_State *L, int b);
180 LUA_API void (*lua_pushlightuserdata) (lua_State *L, void *p);
184 ** get functions (Lua -> stack)
186 LUA_API void (*lua_gettable) (lua_State *L, int idx);
187 LUA_API void (*lua_rawget) (lua_State *L, int idx);
188 LUA_API void (*lua_rawgeti) (lua_State *L, int idx, int n);
189 LUA_API void (*lua_newtable) (lua_State *L);
190 LUA_API void *(*lua_newuserdata) (lua_State *L, size_t sz);
191 LUA_API int (*lua_getmetatable) (lua_State *L, int objindex);
192 LUA_API void (*lua_getfenv) (lua_State *L, int idx);
196 ** set functions (stack -> Lua)
198 LUA_API void (*lua_settable) (lua_State *L, int idx);
199 LUA_API void (*lua_rawset) (lua_State *L, int idx);
200 LUA_API void (*lua_rawseti) (lua_State *L, int idx, int n);
201 LUA_API int (*lua_setmetatable) (lua_State *L, int objindex);
202 LUA_API int (*lua_setfenv) (lua_State *L, int idx);
206 ** `load' and `call' functions (load and run Lua code)
208 LUA_API void (*lua_call) (lua_State *L, int nargs, int nresults);
209 LUA_API int (*lua_pcall) (lua_State *L, int nargs, int nresults, int errfunc);
210 LUA_API int (*lua_cpcall) (lua_State *L, lua_CFunction func, void *ud);
211 LUA_API int (*lua_load) (lua_State *L, lua_Chunkreader reader, void *dt,
212 const char *chunkname);
214 LUA_API int (*lua_dump) (lua_State *L, lua_Chunkwriter writer, void *data);
218 ** coroutine functions
220 LUA_API int (*lua_yield) (lua_State *L, int nresults);
221 LUA_API int (*lua_resume) (lua_State *L, int narg);
224 ** garbage-collection functions
226 LUA_API int (*lua_getgcthreshold) (lua_State *L);
227 LUA_API int (*lua_getgccount) (lua_State *L);
228 LUA_API void (*lua_setgcthreshold) (lua_State *L, int newthreshold);
231 ** miscellaneous functions
234 LUA_API const char *(*lua_version) (void);
236 LUA_API int (*lua_error) (lua_State *L);
238 LUA_API int (*lua_next) (lua_State *L, int idx);
240 LUA_API void (*lua_concat) (lua_State *L, int n);
245 ** ===============================================================
246 ** some useful macros
247 ** ===============================================================
250 #define lua_boxpointer(L,u) \
251 (*(void **)(lua_newuserdata(L, sizeof(void *))) = (u))
253 #define lua_unboxpointer(L,i) (*(void **)(lua_touserdata(L, i)))
255 #define lua_pop(L,n) lua_settop(L, -(n)-1)
257 #define lua_register(L,n,f) \
258 (lua_pushstring(L, n), \
259 lua_pushcfunction(L, f), \
260 lua_settable(L, LUA_GLOBALSINDEX))
262 #define lua_pushcfunction(L,f) lua_pushcclosure(L, f, 0)
264 #define lua_isfunction(L,n) (lua_type(L,n) == LUA_TFUNCTION)
265 #define lua_istable(L,n) (lua_type(L,n) == LUA_TTABLE)
266 #define lua_islightuserdata(L,n) (lua_type(L,n) == LUA_TLIGHTUSERDATA)
267 #define lua_isnil(L,n) (lua_type(L,n) == LUA_TNIL)
268 #define lua_isboolean(L,n) (lua_type(L,n) == LUA_TBOOLEAN)
269 #define lua_isnone(L,n) (lua_type(L,n) == LUA_TNONE)
270 #define lua_isnoneornil(L, n) (lua_type(L,n) <= 0)
272 #define lua_pushliteral(L, s) \
273 lua_pushlstring(L, "" s, (sizeof(s)/sizeof(char))-1)
278 ** compatibility macros and functions
282 LUA_API int (*lua_pushupvalues) (lua_State *L);
284 #define lua_getregistry(L) lua_pushvalue(L, LUA_REGISTRYINDEX)
285 #define lua_setglobal(L,s) \
286 (lua_pushstring(L, s), lua_insert(L, -2), lua_settable(L, LUA_GLOBALSINDEX))
288 #define lua_getglobal(L,s) \
289 (lua_pushstring(L, s), lua_gettable(L, LUA_GLOBALSINDEX))
292 /* compatibility with ref system */
294 /* pre-defined references */
295 #define LUA_NOREF (-2)
296 #define LUA_REFNIL (-1)
298 #define lua_ref(L,lock) ((lock) ? luaL_ref(L, LUA_REGISTRYINDEX) : \
299 (lua_pushstring(L, "unlocked references are obsolete"), lua_error(L), 0))
301 #define lua_unref(L,ref) luaL_unref(L, LUA_REGISTRYINDEX, (ref))
303 #define lua_getref(L,ref) lua_rawgeti(L, LUA_REGISTRYINDEX, ref)
308 ** {======================================================================
309 ** useful definitions for Lua kernel and libraries
310 ** =======================================================================
313 /* formats for Lua numbers */
314 #ifndef LUA_NUMBER_SCAN
315 #define LUA_NUMBER_SCAN "%lf"
316 #endif
318 #ifndef LUA_NUMBER_FMT
319 #define LUA_NUMBER_FMT "%.14g"
320 #endif
322 /* }====================================================================== */
326 ** {======================================================================
327 ** Debug API
328 ** =======================================================================
333 ** Event codes
335 #define LUA_HOOKCALL 0
336 #define LUA_HOOKRET 1
337 #define LUA_HOOKLINE 2
338 #define LUA_HOOKCOUNT 3
339 #define LUA_HOOKTAILRET 4
343 ** Event masks
345 #define LUA_MASKCALL (1 << LUA_HOOKCALL)
346 #define LUA_MASKRET (1 << LUA_HOOKRET)
347 #define LUA_MASKLINE (1 << LUA_HOOKLINE)
348 #define LUA_MASKCOUNT (1 << LUA_HOOKCOUNT)
350 typedef struct lua_Debug lua_Debug; /* activation record */
352 typedef void (*lua_Hook) (lua_State *L, lua_Debug *ar);
355 LUA_API int (*lua_getstack) (lua_State *L, int level, lua_Debug *ar);
356 LUA_API int (*lua_getinfo) (lua_State *L, const char *what, lua_Debug *ar);
357 LUA_API const char *(*lua_getlocal) (lua_State *L, const lua_Debug *ar, int n);
358 LUA_API const char *(*lua_setlocal) (lua_State *L, const lua_Debug *ar, int n);
359 LUA_API const char *(*lua_getupvalue) (lua_State *L, int funcindex, int n);
360 LUA_API const char *(*lua_setupvalue) (lua_State *L, int funcindex, int n);
362 LUA_API int (*lua_sethook) (lua_State *L, lua_Hook func, int mask, int count);
363 LUA_API lua_Hook (*lua_gethook) (lua_State *L);
364 LUA_API int (*lua_gethookmask) (lua_State *L);
365 LUA_API int (*lua_gethookcount) (lua_State *L);
368 #define LUA_IDSIZE 60
370 struct lua_Debug {
371 int event;
372 const char *name; /* (n) */
373 const char *namewhat; /* (n) `global', `local', `field', `method' */
374 const char *what; /* (S) `Lua', `C', `main', `tail' */
375 const char *source; /* (S) */
376 int currentline; /* (l) */
377 int nups; /* (u) number of upvalues */
378 int linedefined; /* (S) */
379 char short_src[LUA_IDSIZE]; /* (S) */
380 /* private part */
381 int i_ci; /* active function */
384 /* }====================================================================== */
386 // from lauxlib.h
389 #include "lua.h"
392 #ifndef LUALIB_API
393 #define LUALIB_API LUA_API
394 #endif
398 typedef struct luaL_reg {
399 const char *name;
400 lua_CFunction func;
401 } luaL_reg;
404 LUALIB_API void (*luaL_openlib) (lua_State *L, const char *libname,
405 const luaL_reg *l, int nup);
406 LUALIB_API int (*luaL_getmetafield) (lua_State *L, int obj, const char *e);
407 LUALIB_API int (*luaL_callmeta) (lua_State *L, int obj, const char *e);
408 LUALIB_API int (*luaL_typerror) (lua_State *L, int narg, const char *tname);
409 LUALIB_API int (*luaL_argerror) (lua_State *L, int numarg, const char *extramsg);
410 LUALIB_API const char *(*luaL_checklstring) (lua_State *L, int numArg, size_t *l);
411 LUALIB_API const char *(*luaL_optlstring) (lua_State *L, int numArg,
412 const char *def, size_t *l);
413 LUALIB_API lua_Number (*luaL_checknumber) (lua_State *L, int numArg);
414 LUALIB_API lua_Number (*luaL_optnumber) (lua_State *L, int nArg, lua_Number def);
416 LUALIB_API void (*luaL_checkstack) (lua_State *L, int sz, const char *msg);
417 LUALIB_API void (*luaL_checktype) (lua_State *L, int narg, int t);
418 LUALIB_API void (*luaL_checkany) (lua_State *L, int narg);
420 LUALIB_API int (*luaL_newmetatable) (lua_State *L, const char *tname);
421 LUALIB_API void (*luaL_getmetatable) (lua_State *L, const char *tname);
422 LUALIB_API void *(*luaL_checkudata) (lua_State *L, int ud, const char *tname);
424 LUALIB_API void (*luaL_where) (lua_State *L, int lvl);
425 LUALIB_API int (*luaL_error) (lua_State *L, const char *fmt, ...);
427 LUALIB_API int (*luaL_findstring) (const char *st, const char *const lst[]);
429 LUALIB_API int (*luaL_ref) (lua_State *L, int t);
430 LUALIB_API void (*luaL_unref) (lua_State *L, int t, int ref);
432 LUALIB_API int (*luaL_getn) (lua_State *L, int t);
433 LUALIB_API void (*luaL_setn) (lua_State *L, int t, int n);
435 LUALIB_API int (*luaL_loadfile) (lua_State *L, const char *filename);
436 LUALIB_API int (*luaL_loadbuffer) (lua_State *L, const char *buff, size_t sz,
437 const char *name);
442 ** ===============================================================
443 ** some useful macros
444 ** ===============================================================
447 #define luaL_argcheck(L, cond,numarg,extramsg) if (!(cond)) \
448 luaL_argerror(L, numarg,extramsg)
449 #define luaL_checkstring(L,n) (luaL_checklstring(L, (n), NULL))
450 #define luaL_optstring(L,n,d) (luaL_optlstring(L, (n), (d), NULL))
451 #define luaL_checkint(L,n) ((int)luaL_checknumber(L, n))
452 #define luaL_checklong(L,n) ((long)luaL_checknumber(L, n))
453 #define luaL_optint(L,n,d) ((int)luaL_optnumber(L, n,(lua_Number)(d)))
454 #define luaL_optlong(L,n,d) ((long)luaL_optnumber(L, n,(lua_Number)(d)))
458 ** {======================================================
459 ** Generic Buffer manipulation
460 ** =======================================================
465 #ifndef LUAL_BUFFERSIZE
466 #define LUAL_BUFFERSIZE BUFSIZ
467 #endif
470 typedef struct luaL_Buffer {
471 char *p; /* current position in buffer */
472 int lvl; /* number of strings in the stack (level) */
473 lua_State *L;
474 char buffer[LUAL_BUFFERSIZE];
475 } luaL_Buffer;
477 #define luaL_putchar(B,c) \
478 ((void)((B)->p < ((B)->buffer+LUAL_BUFFERSIZE) || luaL_prepbuffer(B)), \
479 (*(B)->p++ = (char)(c)))
481 #define luaL_addsize(B,n) ((B)->p += (n))
483 LUALIB_API void (*luaL_buffinit) (lua_State *L, luaL_Buffer *B);
484 LUALIB_API char *(*luaL_prepbuffer) (luaL_Buffer *B);
485 LUALIB_API void (*luaL_addlstring) (luaL_Buffer *B, const char *s, size_t l);
486 LUALIB_API void (*luaL_addstring) (luaL_Buffer *B, const char *s);
487 LUALIB_API void (*luaL_addvalue) (luaL_Buffer *B);
488 LUALIB_API void (*luaL_pushresult) (luaL_Buffer *B);
491 /* }====================================================== */
496 ** Compatibility macros and functions
499 LUALIB_API int (*lua_dofile) (lua_State *L, const char *filename);
500 LUALIB_API int (*lua_dostring) (lua_State *L, const char *str);
501 LUALIB_API int (*lua_dobuffer) (lua_State *L, const char *buff, size_t sz,
502 const char *n);
505 #define luaL_check_lstr luaL_checklstring
506 #define luaL_opt_lstr luaL_optlstring
507 #define luaL_check_number luaL_checknumber
508 #define luaL_opt_number luaL_optnumber
509 #define luaL_arg_check luaL_argcheck
510 #define luaL_check_string luaL_checkstring
511 #define luaL_opt_string luaL_optstring
512 #define luaL_check_int luaL_checkint
513 #define luaL_check_long luaL_checklong
514 #define luaL_opt_int luaL_optint
515 #define luaL_opt_long luaL_optlong
517 // from lualob.h
519 #ifndef LUALIB_API
520 #define LUALIB_API LUA_API
521 #endif
524 #define LUA_COLIBNAME "coroutine"
525 LUALIB_API int (*luaopen_base) (lua_State *L);
527 #define LUA_TABLIBNAME "table"
528 LUALIB_API int (*luaopen_table) (lua_State *L);
530 #define LUA_IOLIBNAME "io"
531 #define LUA_OSLIBNAME "os"
532 LUALIB_API int (*luaopen_io) (lua_State *L);
534 #define LUA_STRLIBNAME "string"
535 LUALIB_API int (*luaopen_string) (lua_State *L);
537 #define LUA_MATHLIBNAME "math"
538 LUALIB_API int (*luaopen_math) (lua_State *L);
540 #define LUA_DBLIBNAME "debug"
541 LUALIB_API int (*luaopen_debug) (lua_State *L);
544 LUALIB_API int (*luaopen_loadlib) (lua_State *L);
547 /* to help testing the libraries */
548 #ifndef lua_assert
549 #define lua_assert(c) /* empty */
550 #endif
553 /* compatibility code */
554 #define lua_baselibopen luaopen_base
555 #define lua_tablibopen luaopen_table
556 #define lua_iolibopen luaopen_io
557 #define lua_strlibopen luaopen_string
558 #define lua_mathlibopen luaopen_math
559 #define lua_dblibopen luaopen_debug
561 /******************************************************************************
562 * Copyright (C) 1994-2004 Tecgraf, PUC-Rio. All rights reserved.
564 * Permission is hereby granted, free of charge, to any person obtaining
565 * a copy of this software and associated documentation files (the
566 * "Software"), to deal in the Software without restriction, including
567 * without limitation the rights to use, copy, modify, merge, publish,
568 * distribute, sublicense, and/or sell copies of the Software, and to
569 * permit persons to whom the Software is furnished to do so, subject to
570 * the following conditions:
572 * The above copyright notice and this permission notice shall be
573 * included in all copies or substantial portions of the Software.
575 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
576 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
577 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
578 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
579 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
580 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
581 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
582 ******************************************************************************/
584 // prototype of functions
586 // from lua.h
587 typedef lua_State *(*Tlua_open) (void);
588 typedef void (*Tlua_close) (lua_State *L);
589 typedef lua_State *(*Tlua_newthread) (lua_State *L);
590 typedef lua_CFunction (*Tlua_atpanic) (lua_State *L, lua_CFunction panicf);
591 typedef int (*Tlua_gettop) (lua_State *L);
592 typedef void (*Tlua_settop) (lua_State *L, int idx);
593 typedef void (*Tlua_pushvalue) (lua_State *L, int idx);
594 typedef void (*Tlua_remove) (lua_State *L, int idx);
595 typedef void (*Tlua_insert )(lua_State *L, int idx);
596 typedef void (*Tlua_replace) (lua_State *L, int idx);
597 typedef int (*Tlua_checkstack) (lua_State *L, int sz);
598 typedef void (*Tlua_xmove) (lua_State *from, lua_State *to, int n);
599 typedef int (*Tlua_isnumber) (lua_State *L, int idx);
600 typedef int (*Tlua_isstring) (lua_State *L, int idx);
601 typedef int (*Tlua_iscfunction) (lua_State *L, int idx);
602 typedef int (*Tlua_isuserdata) (lua_State *L, int idx);
603 typedef int (*Tlua_type) (lua_State *L, int idx);
604 typedef const char *(*Tlua_typename) (lua_State *L, int tp);
605 typedef int (*Tlua_equal) (lua_State *L, int idx1, int idx2);
606 typedef int (*Tlua_rawequal) (lua_State *L, int idx1, int idx2);
607 typedef int (*Tlua_lessthan) (lua_State *L, int idx1, int idx2);
608 typedef lua_Number (*Tlua_tonumber) (lua_State *L, int idx);
609 typedef int (*Tlua_toboolean) (lua_State *L, int idx);
610 typedef const char *(*Tlua_tostring) (lua_State *L, int idx);
611 typedef size_t (*Tlua_strlen) (lua_State *L, int idx);
612 typedef lua_CFunction (*Tlua_tocfunction) (lua_State *L, int idx);
613 typedef void *(*Tlua_touserdata) (lua_State *L, int idx);
614 typedef lua_State *(*Tlua_tothread) (lua_State *L, int idx);
615 typedef const void *(*Tlua_topointer) (lua_State *L, int idx);
616 typedef void (*Tlua_pushnil) (lua_State *L);
617 typedef void (*Tlua_pushnumber) (lua_State *L, lua_Number n);
618 typedef void (*Tlua_pushlstring) (lua_State *L, const char *s, size_t l);
619 typedef void (*Tlua_pushstring) (lua_State *L, const char *s);
620 typedef const char *(*Tlua_pushvfstring) (lua_State *L, const char *fmt, ...);
621 typedef const char *(*Tlua_pushfstring) (lua_State *L, const char *fmt, ...);
622 typedef void (*Tlua_pushcclosure) (lua_State *L, lua_CFunction fn, int n);
623 typedef void (*Tlua_pushboolean) (lua_State *L, int b);
624 typedef void (*Tlua_pushlightuserdata) (lua_State *L, void *p);
625 typedef void (*Tlua_gettable) (lua_State *L, int idx);
626 typedef void (*Tlua_rawget) (lua_State *L, int idx);
627 typedef void (*Tlua_rawgeti) (lua_State *L, int idx, int n);
628 typedef void (*Tlua_newtable) (lua_State *L);
629 typedef void *(*Tlua_newuserdata) (lua_State *L, size_t sz);
630 typedef int (*Tlua_getmetatable) (lua_State *L, int objindex);
631 typedef void (*Tlua_getfenv) (lua_State *L, int idx);
632 typedef void (*Tlua_settable) (lua_State *L, int idx);
633 typedef void (*Tlua_rawset) (lua_State *L, int idx);
634 typedef void (*Tlua_rawseti) (lua_State *L, int idx, int n);
635 typedef int (*Tlua_setmetatable) (lua_State *L, int objindex);
636 typedef int (*Tlua_setfenv) (lua_State *L, int idx);
637 typedef void (*Tlua_call) (lua_State *L, int nargs, int nresults);
638 typedef int (*Tlua_pcall) (lua_State *L, int nargs, int nresults, int errfunc);
639 typedef int (*Tlua_cpcall) (lua_State *L, lua_CFunction func, void *ud);
640 typedef int (*Tlua_load) (lua_State *L, lua_Chunkreader reader, void *dt,
641 const char *chunkname);
642 typedef int (*Tlua_dump) (lua_State *L, lua_Chunkwriter writer, void *data);
643 typedef int (*Tlua_yield) (lua_State *L, int nresults);
644 typedef int (*Tlua_resume) (lua_State *L, int narg);
645 typedef int (*Tlua_getgcthreshold) (lua_State *L);
646 typedef int (*Tlua_getgccount) (lua_State *L);
647 typedef void (*Tlua_setgcthreshold) (lua_State *L, int newthreshold);
648 typedef const char *(*Tlua_version) (void);
649 typedef int (*Tlua_error) (lua_State *L);
650 typedef int (*Tlua_next) (lua_State *L, int idx);
651 typedef void (*Tlua_concat) (lua_State *L, int n);
652 typedef int (*Tlua_pushupvalues) (lua_State *L);
653 typedef void (*Tlua_Hook) (lua_State *L, lua_Debug *ar);
654 typedef int (*Tlua_getstack) (lua_State *L, int level, lua_Debug *ar);
655 typedef int (*Tlua_getinfo) (lua_State *L, const char *what, lua_Debug *ar);
656 typedef const char *(*Tlua_getlocal) (lua_State *L, const lua_Debug *ar, int n);
657 typedef const char *(*Tlua_setlocal) (lua_State *L, const lua_Debug *ar, int n);
658 typedef const char *(*Tlua_getupvalue) (lua_State *L, int funcindex, int n);
659 typedef const char *(*Tlua_setupvalue) (lua_State *L, int funcindex, int n);
660 typedef int (*Tlua_sethook) (lua_State *L, lua_Hook func, int mask, int count);
661 typedef lua_Hook (*Tlua_gethook) (lua_State *L);
662 typedef int (*Tlua_gethookmask) (lua_State *L);
663 typedef int (*Tlua_gethookcount) (lua_State *L);
665 // from lauxlib.h
666 typedef void (*TluaL_openlib) (lua_State *L, const char *libname,
667 const luaL_reg *l, int nup);
668 typedef int (*TluaL_getmetafield) (lua_State *L, int obj, const char *e);
669 typedef int (*TluaL_callmeta) (lua_State *L, int obj, const char *e);
670 typedef int (*TluaL_typerror) (lua_State *L, int narg, const char *tname);
671 typedef int (*TluaL_argerror) (lua_State *L, int numarg, const char *extramsg);
672 typedef const char *(*TluaL_checklstring) (lua_State *L, int numArg, size_t *l);
673 typedef const char *(*TluaL_optlstring) (lua_State *L, int numArg,
674 const char *def, size_t *l);
675 typedef lua_Number (*TluaL_checknumber) (lua_State *L, int numArg);
676 typedef lua_Number (*TluaL_optnumber) (lua_State *L, int nArg, lua_Number def);
678 typedef void (*TluaL_checkstack) (lua_State *L, int sz, const char *msg);
679 typedef void (*TluaL_checktype) (lua_State *L, int narg, int t);
680 typedef void (*TluaL_checkany) (lua_State *L, int narg);
682 typedef int (*TluaL_newmetatable) (lua_State *L, const char *tname);
683 typedef void (*TluaL_getmetatable) (lua_State *L, const char *tname);
684 typedef void *(*TluaL_checkudata) (lua_State *L, int ud, const char *tname);
686 typedef void (*TluaL_where) (lua_State *L, int lvl);
687 typedef int (*TluaL_error) (lua_State *L, const char *fmt, ...);
689 typedef int (*TluaL_findstring) (const char *st, const char *const lst[]);
691 typedef int (*TluaL_ref) (lua_State *L, int t);
692 typedef void (*TluaL_unref) (lua_State *L, int t, int ref);
694 typedef int (*TluaL_getn) (lua_State *L, int t);
695 typedef void (*TluaL_setn) (lua_State *L, int t, int n);
697 typedef int (*TluaL_loadfile) (lua_State *L, const char *filename);
698 typedef int (*TluaL_loadbuffer) (lua_State *L, const char *buff, size_t sz,
699 const char *name);
701 typedef void (*TluaL_buffinit) (lua_State *L, luaL_Buffer *B);
702 typedef char *(*TluaL_prepbuffer) (luaL_Buffer *B);
703 typedef void (*TluaL_addlstring) (luaL_Buffer *B, const char *s, size_t l);
704 typedef void (*TluaL_addstring) (luaL_Buffer *B, const char *s);
705 typedef void (*TluaL_addvalue) (luaL_Buffer *B);
706 typedef void (*TluaL_pushresult) (luaL_Buffer *B);
707 typedef int (*Tlua_dofile) (lua_State *L, const char *filename);
708 typedef int (*Tlua_dostring) (lua_State *L, const char *str);
709 typedef int (*Tlua_dobuffer) (lua_State *L, const char *buff, size_t sz,
710 const char *n);
712 // from lualib.h
713 typedef int (*Tluaopen_base) (lua_State *L);
714 typedef int (*Tluaopen_table) (lua_State *L);
715 typedef int (*Tluaopen_io) (lua_State *L);
716 typedef int (*Tluaopen_string) (lua_State *L);
717 typedef int (*Tluaopen_math) (lua_State *L);
718 typedef int (*Tluaopen_debug) (lua_State *L);
719 typedef int (*Tluaopen_loadlib) (lua_State *L);
723 } // extern "C"
725 bool loadLuaDLL();
727 #endif