12 #include "common/scummsys.h" 18 #include "common/lua/luaconf.h" 21 #define LUA_VERSION "Lua 5.1" 22 #define LUA_RELEASE "Lua 5.1.3" 23 #define LUA_VERSION_NUM 501 24 #define LUA_COPYRIGHT "Copyright (C) 1994-2008 Lua.org, PUC-Rio" 25 #define LUA_AUTHORS "R. Ierusalimschy, L. H. de Figueiredo & W. Celes" 29 #define LUA_SIGNATURE "\033Lua" 32 #define LUA_MULTRET (-1) 38 #define LUA_REGISTRYINDEX (-10000) 39 #define LUA_ENVIRONINDEX (-10001) 40 #define LUA_GLOBALSINDEX (-10002) 41 #define lua_upvalueindex(i) (LUA_GLOBALSINDEX-(i)) 47 #define LUA_ERRSYNTAX 3 53 typedef int (*lua_CFunction) (
lua_State *L);
59 typedef const char * (*lua_Reader) (
lua_State *L,
void *ud,
size_t *sz);
61 typedef int (*lua_Writer) (
lua_State *L,
const void* p,
size_t sz,
void* ud);
67 typedef void * (*lua_Alloc) (
void *ud,
void *ptr,
size_t osize,
size_t nsize);
73 #define LUA_TNONE (-1) 76 #define LUA_TBOOLEAN 1 77 #define LUA_TLIGHTUSERDATA 2 81 #define LUA_TFUNCTION 6 82 #define LUA_TUSERDATA 7 88 #define LUA_MINSTACK 20 94 #if defined(LUA_USER_H) 100 typedef LUA_NUMBER lua_Number;
104 typedef LUA_INTEGER lua_Integer;
111 LUA_API
lua_State *(lua_newstate) (lua_Alloc f,
void *ud);
115 LUA_API lua_CFunction (lua_atpanic) (
lua_State *L, lua_CFunction panicf);
122 LUA_API void (lua_settop) (
lua_State *L,
int idx);
123 LUA_API void (lua_pushvalue) (
lua_State *L,
int idx);
124 LUA_API void (lua_remove) (
lua_State *L,
int idx);
125 LUA_API void (lua_insert) (
lua_State *L,
int idx);
126 LUA_API void (lua_replace) (
lua_State *L,
int idx);
127 LUA_API int (lua_checkstack) (
lua_State *L,
int sz);
136 LUA_API int (lua_isnumber) (
lua_State *L,
int idx);
137 LUA_API int (lua_isstring) (
lua_State *L,
int idx);
138 LUA_API int (lua_iscfunction) (
lua_State *L,
int idx);
139 LUA_API int (lua_isuserdata) (
lua_State *L,
int idx);
140 LUA_API int (lua_type) (
lua_State *L,
int idx);
141 LUA_API
const char *(lua_typename) (
lua_State *L,
int tp);
143 LUA_API int (lua_equal) (
lua_State *L,
int idx1,
int idx2);
144 LUA_API int (lua_rawequal) (
lua_State *L,
int idx1,
int idx2);
145 LUA_API int (lua_lessthan) (
lua_State *L,
int idx1,
int idx2);
147 LUA_API lua_Number (lua_tonumber) (
lua_State *L,
int idx);
148 LUA_API lua_Integer (lua_tointeger) (
lua_State *L,
int idx);
149 LUA_API int (lua_toboolean) (
lua_State *L,
int idx);
150 LUA_API
const char *(lua_tolstring) (
lua_State *L,
int idx,
size_t *len);
151 LUA_API size_t (lua_objlen) (
lua_State *L,
int idx);
152 LUA_API lua_CFunction (lua_tocfunction) (
lua_State *L,
int idx);
153 LUA_API
void *(lua_touserdata) (
lua_State *L,
int idx);
155 LUA_API
const void *(lua_topointer) (
lua_State *L,
int idx);
161 LUA_API void (lua_pushnil) (
lua_State *L);
162 LUA_API void (lua_pushnumber) (
lua_State *L, lua_Number n);
163 LUA_API void (lua_pushinteger) (
lua_State *L, lua_Integer n);
164 LUA_API void (lua_pushlstring) (
lua_State *L,
const char *s,
size_t l);
165 LUA_API void (lua_pushstring) (
lua_State *L,
const char *s);
166 LUA_API
const char *(lua_pushvfstring) (
lua_State *L,
const char *fmt,
168 LUA_API
const char *(lua_pushfstring) (
lua_State *L,
const char *fmt, ...);
169 LUA_API void (lua_pushcclosure) (
lua_State *L, lua_CFunction fn,
int n);
170 LUA_API void (lua_pushboolean) (
lua_State *L,
int b);
171 LUA_API void (lua_pushlightuserdata) (
lua_State *L,
void *p);
172 LUA_API int (lua_pushthread) (
lua_State *L);
178 LUA_API void (lua_gettable) (
lua_State *L,
int idx);
179 LUA_API void (lua_getfield) (
lua_State *L,
int idx,
const char *k);
180 LUA_API void (lua_rawget) (
lua_State *L,
int idx);
181 LUA_API void (lua_rawgeti) (
lua_State *L,
int idx,
int n);
182 LUA_API void (lua_createtable) (
lua_State *L,
int narr,
int nrec);
183 LUA_API
void *(lua_newuserdata) (
lua_State *L,
size_t sz);
184 LUA_API int (lua_getmetatable) (
lua_State *L,
int objindex);
185 LUA_API void (lua_getfenv) (
lua_State *L,
int idx);
191 LUA_API void (lua_settable) (
lua_State *L,
int idx);
192 LUA_API void (lua_setfield) (
lua_State *L,
int idx,
const char *k);
193 LUA_API void (lua_rawset) (
lua_State *L,
int idx);
194 LUA_API void (lua_rawseti) (
lua_State *L,
int idx,
int n);
195 LUA_API int (lua_setmetatable) (
lua_State *L,
int objindex);
196 LUA_API int (lua_setfenv) (
lua_State *L,
int idx);
202 LUA_API void (lua_call) (
lua_State *L,
int nargs,
int nresults);
203 LUA_API int (lua_pcall) (
lua_State *L,
int nargs,
int nresults,
int errfunc);
204 LUA_API int (lua_cpcall) (
lua_State *L, lua_CFunction func,
void *ud);
205 LUA_API int (lua_load) (
lua_State *L, lua_Reader reader,
void *dt,
206 const char *chunkname);
208 LUA_API int (lua_dump) (
lua_State *L, lua_Writer writer,
void *data);
214 LUA_API int (lua_yield) (
lua_State *L,
int nresults);
215 LUA_API int (lua_resume) (
lua_State *L,
int narg);
223 #define LUA_GCRESTART 1 224 #define LUA_GCCOLLECT 2 225 #define LUA_GCCOUNT 3 226 #define LUA_GCCOUNTB 4 228 #define LUA_GCSETPAUSE 6 229 #define LUA_GCSETSTEPMUL 7 231 LUA_API int (lua_gc) (
lua_State *L,
int what,
int data);
240 LUA_API int (lua_next) (
lua_State *L,
int idx);
242 LUA_API void (lua_concat) (
lua_State *L,
int n);
244 LUA_API lua_Alloc (lua_getallocf) (
lua_State *L,
void **ud);
245 LUA_API
void lua_setallocf (
lua_State *L, lua_Alloc f,
void *ud);
255 #define lua_pop(L,n) lua_settop(L, -(n)-1) 257 #define lua_newtable(L) lua_createtable(L, 0, 0) 259 #define lua_register(L,n,f) (lua_pushcfunction(L, (f)), lua_setglobal(L, (n))) 261 #define lua_pushcfunction(L,f) lua_pushcclosure(L, (f), 0) 263 #define lua_strlen(L,i) lua_objlen(L, (i)) 265 #define lua_isfunction(L,n) (lua_type(L, (n)) == LUA_TFUNCTION) 266 #define lua_istable(L,n) (lua_type(L, (n)) == LUA_TTABLE) 267 #define lua_islightuserdata(L,n) (lua_type(L, (n)) == LUA_TLIGHTUSERDATA) 268 #define lua_isnil(L,n) (lua_type(L, (n)) == LUA_TNIL) 269 #define lua_isboolean(L,n) (lua_type(L, (n)) == LUA_TBOOLEAN) 270 #define lua_isthread(L,n) (lua_type(L, (n)) == LUA_TTHREAD) 271 #define lua_isnone(L,n) (lua_type(L, (n)) == LUA_TNONE) 272 #define lua_isnoneornil(L, n) (lua_type(L, (n)) <= 0) 274 #define lua_pushliteral(L, s) \ 275 lua_pushlstring(L, "" s, (sizeof(s)/sizeof(char))-1) 277 #define lua_setglobal(L,s) lua_setfield(L, LUA_GLOBALSINDEX, (s)) 278 #define lua_getglobal(L,s) lua_getfield(L, LUA_GLOBALSINDEX, (s)) 280 #define lua_tostring(L,i) lua_tolstring(L, (i), NULL) 288 #define lua_open() luaL_newstate() 290 #define lua_getregistry(L) lua_pushvalue(L, LUA_REGISTRYINDEX) 292 #define lua_getgccount(L) lua_gc(L, LUA_GCCOUNT, 0) 294 #define lua_Chunkreader lua_Reader 295 #define lua_Chunkwriter lua_Writer 312 #define LUA_HOOKCALL 0 313 #define LUA_HOOKRET 1 314 #define LUA_HOOKLINE 2 315 #define LUA_HOOKCOUNT 3 316 #define LUA_HOOKTAILRET 4 322 #define LUA_MASKCALL (1 << LUA_HOOKCALL) 323 #define LUA_MASKRET (1 << LUA_HOOKRET) 324 #define LUA_MASKLINE (1 << LUA_HOOKLINE) 325 #define LUA_MASKCOUNT (1 << LUA_HOOKCOUNT) 338 LUA_API
const char *lua_getupvalue (
lua_State *L,
int funcindex,
int n);
339 LUA_API
const char *lua_setupvalue (
lua_State *L,
int funcindex,
int n);
341 LUA_API
int lua_sethook (
lua_State *L, lua_Hook func,
int mask,
int count);
342 LUA_API lua_Hook lua_gethook (
lua_State *L);
343 LUA_API
int lua_gethookmask (
lua_State *L);
344 LUA_API
int lua_gethookcount (
lua_State *L);
350 const char *namewhat;
357 char short_src[LUA_IDSIZE];