1 /* Converted to D from lua.h by htod */ 2 module luad.c.lua; 3 import core.vararg; 4 import luad.c.luaconf; 5 6 /* 7 ** Lua - An Extensible Extension Language 8 ** Lua.org, PUC-Rio, Brazil (http://www.lua.org) 9 ** See Copyright Notice at the end of this file 10 */ 11 12 //C #ifndef lua_h 13 //C #define lua_h 14 15 //C #include <stdarg.h> 16 //C #include <stddef.h> 17 18 //C #include "luaconf.h" 19 //import luaconf; 20 import luad.c.lauxlib; 21 22 extern (C): 23 24 //C #define LUA_VERSION "Lua 5.1" 25 string LUA_VERSION = "Lua 5.1"; 26 //C #define LUA_RELEASE "Lua 5.1.2" 27 string LUA_RELEASE = "Lua 5.1.2"; 28 //C #define LUA_VERSION_NUM 501 29 //C #define LUA_COPYRIGHT "Copyright (C) 1994-2007 Lua.org, PUC-Rio" 30 string LUA_COPYRIGHT = "Copyright (C) 1994-2007 Lua.org, PUC-Rio"; 31 enum LUA_VERSION_NUM = 501; 32 //C #define LUA_AUTHORS "R. Ierusalimschy, L. H. de Figueiredo & W. Celes" 33 string LUA_AUTHORS = "R. Ierusalimschy, L. H. de Figueiredo & W. Celes"; 34 35 36 /* mark for precompiled code (`<esc>Lua') */ 37 //C #define LUA_SIGNATURE "\033Lua" 38 const char[] LUA_SIGNATURE = "\033Lua"; 39 40 /* option for multiple returns in `lua_pcall' and `lua_call' */ 41 //C #define LUA_MULTRET (-1) 42 const LUA_MULTRET = -1; 43 44 45 /* 46 ** pseudo-indices 47 */ 48 //C #define LUA_REGISTRYINDEX (-10000) 49 const LUA_REGISTRYINDEX = -10000; 50 //C #define LUA_ENVIRONINDEX (-10001) 51 const LUA_ENVIRONINDEX = -10001; 52 //C #define LUA_GLOBALSINDEX (-10002) 53 const LUA_GLOBALSINDEX = -10002; 54 //C #define lua_upvalueindex(i) (LUA_GLOBALSINDEX-(i)) 55 int lua_upvalueindex (int i) { return LUA_GLOBALSINDEX-i; } 56 57 58 /* thread status; 0 is OK */ 59 //C #define LUA_YIELD 1 60 //C #define LUA_ERRRUN 2 61 const LUA_YIELD = 1; 62 //C #define LUA_ERRSYNTAX 3 63 const LUA_ERRRUN = 2; 64 //C #define LUA_ERRMEM 4 65 const LUA_ERRSYNTAX = 3; 66 //C #define LUA_ERRERR 5 67 const LUA_ERRMEM = 4; 68 69 const LUA_ERRERR = 5; 70 71 //C typedef struct lua_State lua_State; 72 struct lua_State {} 73 74 //C typedef int (*lua_CFunction) (lua_State *L); 75 alias int function(lua_State *L) lua_CFunction; 76 77 78 /* 79 ** functions that read/write blocks when loading/dumping Lua chunks 80 */ 81 //C typedef const char * (*lua_Reader) (lua_State *L, void *ud, size_t *sz); 82 alias char * function(lua_State *L, void *ud, size_t *sz)lua_Reader; 83 84 //C typedef int (*lua_Writer) (lua_State *L, const void* p, size_t sz, void* ud); 85 alias int function(lua_State *L, const void *p, size_t sz, void *ud)lua_Writer; 86 87 88 /* 89 ** prototype for memory-allocation functions 90 */ 91 //C typedef void * (*lua_Alloc) (void *ud, void *ptr, size_t osize, size_t nsize); 92 alias void * function(void *ud, void *ptr, size_t osize, size_t nsize)lua_Alloc; 93 94 95 /* 96 ** basic types 97 */ 98 //C #define LUA_TNONE (-1) 99 const LUA_TNONE = -1; 100 101 //C #define LUA_TNIL 0 102 //C #define LUA_TBOOLEAN 1 103 const LUA_TNIL = 0; 104 //C #define LUA_TLIGHTUSERDATA 2 105 const LUA_TBOOLEAN = 1; 106 //C #define LUA_TNUMBER 3 107 const LUA_TLIGHTUSERDATA = 2; 108 //C #define LUA_TSTRING 4 109 const LUA_TNUMBER = 3; 110 //C #define LUA_TTABLE 5 111 const LUA_TSTRING = 4; 112 //C #define LUA_TFUNCTION 6 113 const LUA_TTABLE = 5; 114 //C #define LUA_TUSERDATA 7 115 const LUA_TFUNCTION = 6; 116 //C #define LUA_TTHREAD 8 117 const LUA_TUSERDATA = 7; 118 119 const LUA_TTHREAD = 8; 120 121 122 /* minimum Lua stack available to a C function */ 123 //C #define LUA_MINSTACK 20 124 125 const LUA_MINSTACK = 20; 126 127 /* 128 ** generic extra include file 129 */ 130 //C #if defined(LUA_USER_H) 131 //C #include LUA_USER_H 132 //C #endif 133 134 135 /* type of numbers in Lua */ 136 //C typedef LUA_NUMBER lua_Number; 137 alias double lua_Number; 138 139 140 /* type for integer functions */ 141 //C typedef LUA_INTEGER lua_Integer; 142 alias ptrdiff_t lua_Integer; 143 144 145 146 /* 147 ** state manipulation 148 */ 149 //C LUA_API lua_State *(lua_newstate) (lua_Alloc f, void *ud); 150 lua_State * lua_newstate(lua_Alloc f, void *ud); 151 //C LUA_API void (lua_close) (lua_State *L); 152 void lua_close(lua_State *L); 153 //C LUA_API lua_State *(lua_newthread) (lua_State *L); 154 lua_State * lua_newthread(lua_State *L); 155 156 //C LUA_API lua_CFunction (lua_atpanic) (lua_State *L, lua_CFunction panicf); 157 lua_CFunction lua_atpanic(lua_State *L, lua_CFunction panicf); 158 159 160 /* 161 ** basic stack manipulation 162 */ 163 //C LUA_API int (lua_gettop) (lua_State *L); 164 int lua_gettop(lua_State *L) nothrow; 165 //C LUA_API void (lua_settop) (lua_State *L, int idx); 166 void lua_settop(lua_State *L, int idx) nothrow; 167 //C LUA_API void (lua_pushvalue) (lua_State *L, int idx); 168 void lua_pushvalue(lua_State *L, int idx) nothrow; 169 //C LUA_API void (lua_remove) (lua_State *L, int idx); 170 void lua_remove(lua_State *L, int idx); 171 //C LUA_API void (lua_insert) (lua_State *L, int idx); 172 void lua_insert(lua_State *L, int idx); 173 //C LUA_API void (lua_replace) (lua_State *L, int idx); 174 void lua_replace(lua_State *L, int idx); 175 //C LUA_API int (lua_checkstack) (lua_State *L, int sz); 176 int lua_checkstack(lua_State *L, int sz); 177 178 //C LUA_API void (lua_xmove) (lua_State *from, lua_State *to, int n); 179 void lua_xmove(lua_State *from, lua_State *to, int n); 180 181 182 /* 183 ** access functions (stack -> C) 184 */ 185 186 //C LUA_API int (lua_isnumber) (lua_State *L, int idx); 187 int lua_isnumber(lua_State *L, int idx); 188 //C LUA_API int (lua_isstring) (lua_State *L, int idx); 189 int lua_isstring(lua_State *L, int idx); 190 //C LUA_API int (lua_iscfunction) (lua_State *L, int idx); 191 int lua_iscfunction(lua_State *L, int idx); 192 //C LUA_API int (lua_isuserdata) (lua_State *L, int idx); 193 int lua_isuserdata(lua_State *L, int idx); 194 //C LUA_API int (lua_type) (lua_State *L, int idx); 195 int lua_type(lua_State *L, int idx) nothrow; 196 //C LUA_API const char *(lua_typename) (lua_State *L, int tp); 197 char * lua_typename(lua_State *L, int tp) nothrow; 198 199 //C LUA_API int (lua_equal) (lua_State *L, int idx1, int idx2); 200 bool lua_equal(lua_State *L, int idx1, int idx2); 201 //C LUA_API int (lua_rawequal) (lua_State *L, int idx1, int idx2); 202 bool lua_rawequal(lua_State *L, int idx1, int idx2); 203 //C LUA_API int (lua_lessthan) (lua_State *L, int idx1, int idx2); 204 bool lua_lessthan(lua_State *L, int idx1, int idx2); 205 206 //C LUA_API lua_Number (lua_tonumber) (lua_State *L, int idx); 207 lua_Number lua_tonumber(lua_State *L, int idx); 208 //C LUA_API lua_Integer (lua_tointeger) (lua_State *L, int idx); 209 lua_Integer lua_tointeger(lua_State *L, int idx); 210 //C LUA_API int (lua_toboolean) (lua_State *L, int idx); 211 bool lua_toboolean(lua_State *L, int idx); 212 //C LUA_API const char *(lua_tolstring) (lua_State *L, int idx, size_t *len); 213 const(char)* lua_tolstring(lua_State *L, int idx, size_t *len); 214 //C LUA_API size_t (lua_objlen) (lua_State *L, int idx); 215 size_t lua_objlen(lua_State *L, int idx); 216 //C LUA_API lua_CFunction (lua_tocfunction) (lua_State *L, int idx); 217 lua_CFunction lua_tocfunction(lua_State *L, int idx); 218 //C LUA_API void *(lua_touserdata) (lua_State *L, int idx); 219 void * lua_touserdata(lua_State *L, int idx); 220 //C LUA_API lua_State *(lua_tothread) (lua_State *L, int idx); 221 lua_State * lua_tothread(lua_State *L, int idx); 222 //C LUA_API const void *(lua_topointer) (lua_State *L, int idx); 223 void * lua_topointer(lua_State *L, int idx); 224 225 226 /* 227 ** push functions (C -> stack) 228 */ 229 //C LUA_API void (lua_pushnil) (lua_State *L); 230 void lua_pushnil(lua_State *L); 231 //C LUA_API void (lua_pushnumber) (lua_State *L, lua_Number n); 232 void lua_pushnumber(lua_State *L, lua_Number n); 233 //C LUA_API void (lua_pushinteger) (lua_State *L, lua_Integer n); 234 void lua_pushinteger(lua_State *L, lua_Integer n); 235 //C LUA_API void (lua_pushlstring) (lua_State *L, const char *s, size_t l); 236 void lua_pushlstring(lua_State *L, const(char)* s, size_t l); 237 //C LUA_API void (lua_pushstring) (lua_State *L, const char *s); 238 void lua_pushstring(lua_State *L, const(char)* s); 239 //C LUA_API const char *(lua_pushvfstring) (lua_State *L, const char *fmt, 240 //C va_list argp); 241 const(char)* lua_pushvfstring(lua_State *L, const char *fmt, va_list argp); 242 243 244 //C LUA_API const char *(lua_pushfstring) (lua_State *L, const char *fmt, ...); 245 const(char)* lua_pushfstring(lua_State *L, const(char)* fmt,...); 246 //C LUA_API void (lua_pushcclosure) (lua_State *L, lua_CFunction fn, int n); 247 void lua_pushcclosure(lua_State *L, lua_CFunction fn, int n); 248 //C LUA_API void (lua_pushboolean) (lua_State *L, int b); 249 void lua_pushboolean(lua_State *L, int b); 250 //C LUA_API void (lua_pushlightuserdata) (lua_State *L, void *p); 251 void lua_pushlightuserdata(lua_State *L, void *p); 252 //C LUA_API int (lua_pushthread) (lua_State *L); 253 int lua_pushthread(lua_State *L); 254 255 256 /* 257 ** get functions (Lua -> stack) 258 */ 259 //C LUA_API void (lua_gettable) (lua_State *L, int idx); 260 void lua_gettable(lua_State *L, int idx); 261 //C LUA_API void (lua_getfield) (lua_State *L, int idx, const char *k); 262 void lua_getfield(lua_State *L, int idx, const(char)* k); 263 //C LUA_API void (lua_rawget) (lua_State *L, int idx); 264 void lua_rawget(lua_State *L, int idx); 265 //C LUA_API void (lua_rawgeti) (lua_State *L, int idx, int n); 266 void lua_rawgeti(lua_State *L, int idx, int n) nothrow; 267 //C LUA_API void (lua_createtable) (lua_State *L, int narr, int nrec); 268 void lua_createtable(lua_State *L, int narr, int nrec); 269 //C LUA_API void *(lua_newuserdata) (lua_State *L, size_t sz); 270 void * lua_newuserdata(lua_State *L, size_t sz); 271 //C LUA_API int (lua_getmetatable) (lua_State *L, int objindex); 272 int lua_getmetatable(lua_State *L, int objindex); 273 //C LUA_API void (lua_getfenv) (lua_State *L, int idx); 274 void lua_getfenv(lua_State *L, int idx); 275 276 277 /* 278 ** set functions (stack -> Lua) 279 */ 280 //C LUA_API void (lua_settable) (lua_State *L, int idx); 281 void lua_settable(lua_State *L, int idx); 282 //C LUA_API void (lua_setfield) (lua_State *L, int idx, const char *k); 283 void lua_setfield(lua_State *L, int idx, const(char)* k); 284 //C LUA_API void (lua_rawset) (lua_State *L, int idx); 285 void lua_rawset(lua_State *L, int idx); 286 //C LUA_API void (lua_rawseti) (lua_State *L, int idx, int n); 287 void lua_rawseti(lua_State *L, int idx, int n); 288 //C LUA_API int (lua_setmetatable) (lua_State *L, int objindex); 289 int lua_setmetatable(lua_State *L, int objindex); 290 //C LUA_API int (lua_setfenv) (lua_State *L, int idx); 291 int lua_setfenv(lua_State *L, int idx); 292 293 294 /* 295 ** `load' and `call' functions (load and run Lua code) 296 */ 297 //C LUA_API void (lua_call) (lua_State *L, int nargs, int nresults); 298 void lua_call(lua_State *L, int nargs, int nresults); 299 //C LUA_API int (lua_pcall) (lua_State *L, int nargs, int nresults, int errfunc); 300 int lua_pcall(lua_State *L, int nargs, int nresults, int errfunc); 301 //C LUA_API int (lua_cpcall) (lua_State *L, lua_CFunction func, void *ud); 302 int lua_cpcall(lua_State *L, lua_CFunction func, void *ud); 303 //C LUA_API int (lua_load) (lua_State *L, lua_Reader reader, void *dt, 304 //C const char *chunkname); 305 int lua_load(lua_State *L, lua_Reader reader, void *dt, const(char)* chunkname); 306 307 //C LUA_API int (lua_dump) (lua_State *L, lua_Writer writer, void *data); 308 int lua_dump(lua_State *L, lua_Writer writer, void *data); 309 310 311 /* 312 ** coroutine functions 313 */ 314 //C LUA_API int (lua_yield) (lua_State *L, int nresults); 315 int lua_yield(lua_State *L, int nresults); 316 //C LUA_API int (lua_resume) (lua_State *L, int narg); 317 int lua_resume(lua_State *L, int narg); 318 //C LUA_API int (lua_status) (lua_State *L); 319 int lua_status(lua_State *L); 320 321 /* 322 ** garbage-collection function and options 323 */ 324 325 //C #define LUA_GCSTOP 0 326 //C #define LUA_GCRESTART 1 327 const LUA_GCSTOP = 0; 328 //C #define LUA_GCCOLLECT 2 329 const LUA_GCRESTART = 1; 330 //C #define LUA_GCCOUNT 3 331 const LUA_GCCOLLECT = 2; 332 //C #define LUA_GCCOUNTB 4 333 const LUA_GCCOUNT = 3; 334 //C #define LUA_GCSTEP 5 335 const LUA_GCCOUNTB = 4; 336 //C #define LUA_GCSETPAUSE 6 337 const LUA_GCSTEP = 5; 338 //C #define LUA_GCSETSTEPMUL 7 339 const LUA_GCSETPAUSE = 6; 340 341 const LUA_GCSETSTEPMUL = 7; 342 //C LUA_API int (lua_gc) (lua_State *L, int what, int data); 343 int lua_gc(lua_State *L, int what, int data); 344 345 346 /* 347 ** miscellaneous functions 348 */ 349 350 //C LUA_API int (lua_error) (lua_State *L); 351 int lua_error(lua_State *L); 352 353 //C LUA_API int (lua_next) (lua_State *L, int idx); 354 int lua_next(lua_State *L, int idx); 355 356 //C LUA_API void (lua_concat) (lua_State *L, int n); 357 void lua_concat(lua_State *L, int n); 358 359 //C LUA_API lua_Alloc (lua_getallocf) (lua_State *L, void **ud); 360 lua_Alloc lua_getallocf(lua_State *L, void **ud); 361 //C LUA_API void lua_setallocf (lua_State *L, lua_Alloc f, void *ud); 362 void lua_setallocf(lua_State *L, lua_Alloc f, void *ud); 363 364 365 366 /* 367 ** =============================================================== 368 ** some useful macros 369 ** =============================================================== 370 */ 371 372 //C #define lua_pop(L,n) lua_settop(L, -(n)-1) 373 void lua_pop(lua_State* L, int n) nothrow { lua_settop(L, -(n)-1); } 374 375 //C #define lua_newtable(L) lua_createtable(L, 0, 0) 376 void lua_newtable(lua_State* L) { lua_createtable(L, 0, 0); } 377 378 //C #define lua_register(L,n,f) (lua_pushcfunction(L, (f)), lua_setglobal(L, (n))) 379 void lua_register(lua_State* L, const(char)* n, lua_CFunction f) { lua_pushcfunction(L, f); lua_setglobal(L, n); } 380 381 //C #define lua_pushcfunction(L,f) lua_pushcclosure(L, (f), 0) 382 void lua_pushcfunction(lua_State* L, lua_CFunction f) { lua_pushcclosure(L, f, 0); } 383 384 //C #define lua_strlen(L,i) lua_objlen(L, (i)) 385 alias lua_objlen lua_strlen; 386 387 //C #define lua_isfunction(L,n) (lua_type(L, (n)) == LUA_TFUNCTION) 388 bool lua_isfunction(lua_State* L, int n) { return lua_type(L, n) == LUA_TFUNCTION; } 389 //C #define lua_istable(L,n) (lua_type(L, (n)) == LUA_TTABLE) 390 bool lua_istable(lua_State* L, int n) { return lua_type(L, n) == LUA_TTABLE; } 391 //C #define lua_islightuserdata(L,n) (lua_type(L, (n)) == LUA_TLIGHTUSERDATA) 392 bool lua_islightuserdata(lua_State* L, int n) { return lua_type(L, n) == LUA_TLIGHTUSERDATA; } 393 //C #define lua_isnil(L,n) (lua_type(L, (n)) == LUA_TNIL) 394 bool lua_isnil(lua_State* L, int n) { return lua_type(L, n) == LUA_TNIL; } 395 //C #define lua_isboolean(L,n) (lua_type(L, (n)) == LUA_TBOOLEAN) 396 bool lua_isboolean(lua_State* L, int n) { return lua_type(L, n) == LUA_TBOOLEAN; } 397 //C #define lua_isthread(L,n) (lua_type(L, (n)) == LUA_TTHREAD) 398 bool lua_isthread(lua_State* L, int n) { return lua_type(L, n) == LUA_TTHREAD; } 399 //C #define lua_isnone(L,n) (lua_type(L, (n)) == LUA_TNONE) 400 bool lua_isnone(lua_State* L, int n) { return lua_type(L, n) == LUA_TNONE; } 401 //C #define lua_isnoneornil(L, n) (lua_type(L, (n)) <= 0) 402 bool lua_isnoneornil(lua_State* L, int n) { return lua_type(L, n) <= 0; } 403 404 //C #define lua_pushliteral(L, s) lua_pushlstring(L, "" s, (sizeof(s)/sizeof(char))-1) 405 void lua_pushliteral(lua_State* L, string s) { lua_pushlstring(L, s.ptr, s.length); } 406 407 //C #define lua_setglobal(L,s) lua_setfield(L, LUA_GLOBALSINDEX, (s)) 408 void lua_setglobal(lua_State* L, const(char)* s) { lua_setfield(L, LUA_GLOBALSINDEX, s); } 409 410 //C #define lua_getglobal(L,s) lua_getfield(L, LUA_GLOBALSINDEX, (s)) 411 void lua_getglobal(lua_State* L, const(char)* s) { lua_getfield(L, LUA_GLOBALSINDEX, s); } 412 413 //C #define lua_tostring(L,i) lua_tolstring(L, (i), NULL) 414 const(char)* lua_tostring(lua_State* L, int i) { return lua_tolstring(L, i, null); } 415 416 417 418 /* 419 ** compatibility macros and functions 420 */ 421 422 //C #define lua_open() luaL_newstate() 423 alias luaL_newstate lua_open; 424 425 //C #define lua_getregistry(L) lua_pushvalue(L, LUA_REGISTRYINDEX) 426 void lua_getregistry(lua_State* L) { lua_pushvalue(L, LUA_REGISTRYINDEX); } 427 428 //C #define lua_getgccount(L) lua_gc(L, LUA_GCCOUNT, 0) 429 int lua_getgccount(lua_State* L) { return lua_gc(L, LUA_GCCOUNT, 0); } 430 431 //C #define lua_Chunkreader lua_Reader 432 //C #define lua_Chunkwriter lua_Writer 433 alias lua_Reader lua_Chunkreader; 434 435 alias lua_Writer lua_Chunkwriter; 436 437 438 /* 439 ** {====================================================================== 440 ** Debug API 441 ** ======================================================================= 442 */ 443 444 445 /* 446 ** Event codes 447 */ 448 //C #define LUA_HOOKCALL 0 449 //C #define LUA_HOOKRET 1 450 const LUA_HOOKCALL = 0; 451 //C #define LUA_HOOKLINE 2 452 const LUA_HOOKRET = 1; 453 //C #define LUA_HOOKCOUNT 3 454 const LUA_HOOKLINE = 2; 455 //C #define LUA_HOOKTAILRET 4 456 const LUA_HOOKCOUNT = 3; 457 458 const LUA_HOOKTAILRET = 4; 459 460 /* 461 ** Event masks 462 */ 463 //C #define LUA_MASKCALL (1 << LUA_HOOKCALL) 464 const LUA_MASKCALL = 1 << LUA_HOOKCALL; 465 //C #define LUA_MASKRET (1 << LUA_HOOKRET) 466 const LUA_MASKRET = 1 << LUA_HOOKRET; 467 //C #define LUA_MASKLINE (1 << LUA_HOOKLINE) 468 const LUA_MASKLINE = 1 << LUA_HOOKLINE; 469 //C #define LUA_MASKCOUNT (1 << LUA_HOOKCOUNT) 470 const LUA_MASKCOUNT = 1 << LUA_HOOKCOUNT; 471 472 //C typedef struct lua_Debug lua_Debug; /* activation record */ 473 474 475 /* Functions to be called by the debuger in specific events */ 476 //C typedef void (*lua_Hook) (lua_State *L, lua_Debug *ar); 477 alias void function(lua_State *L, lua_Debug *ar)lua_Hook; 478 479 480 //C LUA_API int lua_getstack (lua_State *L, int level, lua_Debug *ar); 481 int lua_getstack(lua_State *L, int level, lua_Debug *ar); 482 //C LUA_API int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar); 483 int lua_getinfo(lua_State *L, const(char)* what, lua_Debug *ar); 484 //C LUA_API const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n); 485 const(char)* lua_getlocal(lua_State *L, lua_Debug *ar, int n); 486 //C LUA_API const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n); 487 const(char)* lua_setlocal(lua_State *L, lua_Debug *ar, int n); 488 //C LUA_API const char *lua_getupvalue (lua_State *L, int funcindex, int n); 489 const(char)* lua_getupvalue(lua_State *L, int funcindex, int n); 490 //C LUA_API const char *lua_setupvalue (lua_State *L, int funcindex, int n); 491 const(char)* lua_setupvalue(lua_State *L, int funcindex, int n); 492 493 //C LUA_API int lua_sethook (lua_State *L, lua_Hook func, int mask, int count); 494 int lua_sethook(lua_State *L, lua_Hook func, int mask, int count); 495 //C LUA_API lua_Hook lua_gethook (lua_State *L); 496 lua_Hook lua_gethook(lua_State *L); 497 //C LUA_API int lua_gethookmask (lua_State *L); 498 int lua_gethookmask(lua_State *L); 499 //C LUA_API int lua_gethookcount (lua_State *L); 500 int lua_gethookcount(lua_State *L); 501 502 503 //C struct lua_Debug { 504 //C int event; 505 //C const char *name; /* (n) */ 506 //C const char *namewhat; /* (n) `global', `local', `field', `method' */ 507 //C const char *what; /* (S) `Lua', `C', `main', `tail' */ 508 //C const char *source; /* (S) */ 509 //C int currentline; /* (l) */ 510 //C int nups; /* (u) number of upvalues */ 511 //C int linedefined; /* (S) */ 512 //C int lastlinedefined; /* (S) */ 513 //C char short_src[LUA_IDSIZE]; /* (S) */ 514 /* private part */ 515 //C int i_ci; /* active function */ 516 //C }; 517 struct lua_Debug 518 { 519 int event; 520 const char *name; 521 const char *namewhat; 522 const char *what; 523 const char *source; 524 int currentline; 525 int nups; 526 int linedefined; 527 int lastlinedefined; 528 char [LUA_IDSIZE]short_src; 529 int i_ci; 530 } 531 532 /* }====================================================================== */ 533 534 535 /****************************************************************************** 536 * Copyright (C) 1994-2007 Lua.org, PUC-Rio. All rights reserved. 537 * 538 * Permission is hereby granted, free of charge, to any person obtaining 539 * a copy of this software and associated documentation files (the 540 * "Software"), to deal in the Software without restriction, including 541 * without limitation the rights to use, copy, modify, merge, publish, 542 * distribute, sublicense, and/or sell copies of the Software, and to 543 * permit persons to whom the Software is furnished to do so, subject to 544 * the following conditions: 545 * 546 * The above copyright notice and this permission notice shall be 547 * included in all copies or substantial portions of the Software. 548 * 549 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 550 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 551 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 552 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 553 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 554 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 555 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 556 ******************************************************************************/ 557 558 559 //C #endif