hedgewars/LuaPas.pas
changeset 10015 4feced261c68
parent 9236 ddd675825672
child 10124 aabd1b75d5a3
equal deleted inserted replaced
10014:56d2f2d5aad8 10015:4feced261c68
    19 {$IFNDEF WIN32}
    19 {$IFNDEF WIN32}
    20     {$linklib lua}
    20     {$linklib lua}
    21 {$ENDIF}
    21 {$ENDIF}
    22 
    22 
    23 type
    23 type
       
    24 {$IFNDEF PAS2C}
    24     size_t   = Cardinal;
    25     size_t   = Cardinal;
       
    26 {$ENDIF}
    25     Psize_t  = ^size_t;
    27     Psize_t  = ^size_t;
    26     PPointer = ^Pointer;
    28     PPointer = ^Pointer;
    27 
    29 
    28     lua_State = record end;
    30     lua_State = record end;
    29     Plua_State = ^lua_State;
    31     Plua_State = ^lua_State;
    53 (*
    55 (*
    54 @@ LUA_IDSIZE gives the maximum size for the description of the source
    56 @@ LUA_IDSIZE gives the maximum size for the description of the source
    55 @* of a function in debug information.
    57 @* of a function in debug information.
    56 ** CHANGE it if you want a different size.
    58 ** CHANGE it if you want a different size.
    57 *)
    59 *)
       
    60 
    58 const
    61 const
    59     LUA_IDSIZE = 60;
    62     LUA_IDSIZE = 60;
    60 
    63 
    61 (*
    64 (*
    62 @@ LUAL_BUFFERSIZE is the buffer size used by the lauxlib buffer system.
    65 @@ LUAL_BUFFERSIZE is the buffer size used by the lauxlib buffer system.
    63 *)
    66 *)
       
    67 
    64 const
    68 const
    65     LUAL_BUFFERSIZE = 1024;
    69     LUAL_BUFFERSIZE = 1024;
    66 
    70 
    67 (*
    71 (*
    68 @@ LUA_PROMPT is the default prompt used by stand-alone Lua.
    72 @@ LUA_PROMPT is the default prompt used by stand-alone Lua.
    69 @@ LUA_PROMPT2 is the default continuation prompt used by stand-alone Lua.
    73 @@ LUA_PROMPT2 is the default continuation prompt used by stand-alone Lua.
    70 ** CHANGE them if you want different prompts. (You can also change the
    74 ** CHANGE them if you want different prompts. (You can also change the
    71 ** prompts dynamically, assigning to globals _PROMPT/_PROMPT2.)
    75 ** prompts dynamically, assigning to globals _PROMPT/_PROMPT2.)
    72 *)
    76 *)
       
    77 
    73 const
    78 const
    74     LUA_PROMPT  = '> ';
    79     LUA_PROMPT  = '> ';
    75     LUA_PROMPT2 = '>> ';
    80     LUA_PROMPT2 = '>> ';
    76 
    81 
    77 (*
    82 (*
   111 ** Lua - An Extensible Extension Language
   116 ** Lua - An Extensible Extension Language
   112 ** Lua.org, PUC-Rio, Brazil (http://www.lua.org)
   117 ** Lua.org, PUC-Rio, Brazil (http://www.lua.org)
   113 ** See Copyright Notice at the end of this file
   118 ** See Copyright Notice at the end of this file
   114 *)
   119 *)
   115 
   120 
       
   121 
   116 const
   122 const
   117     LUA_VERSION     = 'Lua 5.1';
   123     LUA_VERSION     = 'Lua 5.1';
   118     LUA_VERSION_NUM = 501;
   124     LUA_VERSION_NUM = 501;
   119     LUA_COPYRIGHT   = 'Copyright (C) 1994-2006 Tecgraf, PUC-Rio';
   125     LUA_COPYRIGHT   = 'Copyright (C) 1994-2006 Tecgraf, PUC-Rio';
   120     LUA_AUTHORS     = 'R. Ierusalimschy, L. H. de Figueiredo & W. Celes';
   126     LUA_AUTHORS     = 'R. Ierusalimschy, L. H. de Figueiredo & W. Celes';
   130     *)
   136     *)
   131     LUA_REGISTRYINDEX = -10000;
   137     LUA_REGISTRYINDEX = -10000;
   132     LUA_ENVIRONINDEX  = -10001;
   138     LUA_ENVIRONINDEX  = -10001;
   133     LUA_GLOBALSINDEX  = -10002;
   139     LUA_GLOBALSINDEX  = -10002;
   134 
   140 
       
   141 
   135 function lua_upvalueindex(idx : LongInt) : LongInt;   // a marco
   142 function lua_upvalueindex(idx : LongInt) : LongInt;   // a marco
       
   143 
   136 
   144 
   137 const
   145 const
   138    (* thread status; 0 is OK *)
   146    (* thread status; 0 is OK *)
   139     LUA_YIELD_    = 1;     // Note: the ending underscore is needed in Pascal
   147     LUA_YIELD_    = 1;     // Note: the ending underscore is needed in Pascal
   140     LUA_ERRRUN    = 2;
   148     LUA_ERRRUN    = 2;
   141     LUA_ERRSYNTAX = 3;
   149     LUA_ERRSYNTAX = 3;
   142     LUA_ERRMEM    = 4;
   150     LUA_ERRMEM    = 4;
   143     LUA_ERRERR    = 5;
   151     LUA_ERRERR    = 5;
   144 
   152 
       
   153 
   145 type
   154 type
   146    lua_CFunction = function(L : Plua_State) : LongInt; cdecl;
   155    lua_CFunction = function(L : Plua_State) : LongInt; cdecl;
   147 
   156 
   148     (*
   157     (*
   149     ** functions that read/write blocks when loading/dumping Lua chunks
   158     ** functions that read/write blocks when loading/dumping Lua chunks
   153 
   162 
   154   (*
   163   (*
   155   ** prototype for memory-allocation functions
   164   ** prototype for memory-allocation functions
   156   *)
   165   *)
   157   lua_Alloc = function (ud, ptr : Pointer; osize, nsize : size_t) : Pointer; cdecl;
   166   lua_Alloc = function (ud, ptr : Pointer; osize, nsize : size_t) : Pointer; cdecl;
       
   167 
   158 
   168 
   159 const
   169 const
   160     (*
   170     (*
   161     ** basic types
   171     ** basic types
   162     *)
   172     *)
   179     lua_Number = LUA_NUMBER_;
   189     lua_Number = LUA_NUMBER_;
   180 
   190 
   181     (* type for integer functions *)
   191     (* type for integer functions *)
   182     lua_Integer = LUA_INTEGER_;
   192     lua_Integer = LUA_INTEGER_;
   183 
   193 
       
   194 
   184 (*
   195 (*
   185 ** state manipulation
   196 ** state manipulation
   186 *)
   197 *)
   187 function  lua_newstate(f : lua_Alloc; ud : Pointer) : Plua_State;
   198 function  lua_newstate(f : lua_Alloc; ud : Pointer) : Plua_State;
   188     cdecl; external LuaLibName;
   199     cdecl; external LuaLibName;
   189     
   200 
   190 procedure lua_close(L: Plua_State);
   201 procedure lua_close(L: Plua_State);
   191     cdecl; external LuaLibName;
   202     cdecl; external LuaLibName;
   192 function  lua_newthread(L : Plua_State) : Plua_State;
   203 function  lua_newthread(L : Plua_State) : Plua_State;
   193     cdecl; external LuaLibName;
   204     cdecl; external LuaLibName;
   194 
   205 
   199 (*
   210 (*
   200 ** basic stack manipulation
   211 ** basic stack manipulation
   201 *)
   212 *)
   202 function  lua_gettop(L : Plua_State) : LongInt;
   213 function  lua_gettop(L : Plua_State) : LongInt;
   203     cdecl; external LuaLibName;
   214     cdecl; external LuaLibName;
   204     
   215 
   205 procedure lua_settop(L : Plua_State; idx : LongInt);
   216 procedure lua_settop(L : Plua_State; idx : LongInt);
   206     cdecl; external LuaLibName;
   217     cdecl; external LuaLibName;
   207     
   218 
   208 procedure lua_pushvalue(L : Plua_State; idx : LongInt);
   219 procedure lua_pushvalue(L : Plua_State; idx : LongInt);
   209     cdecl; external LuaLibName;
   220     cdecl; external LuaLibName;
   210     
   221 
   211 procedure lua_remove(L : Plua_State; idx : LongInt);
   222 procedure lua_remove(L : Plua_State; idx : LongInt);
   212     cdecl; external LuaLibName;
   223     cdecl; external LuaLibName;
   213     
   224 
   214 procedure lua_insert(L : Plua_State; idx : LongInt);
   225 procedure lua_insert(L : Plua_State; idx : LongInt);
   215     cdecl; external LuaLibName;
   226     cdecl; external LuaLibName;
   216     
   227 
   217 procedure lua_replace(L : Plua_State; idx : LongInt);
   228 procedure lua_replace(L : Plua_State; idx : LongInt);
   218     cdecl; external LuaLibName;
   229     cdecl; external LuaLibName;
   219     
   230 
   220 function  lua_checkstack(L : Plua_State; sz : LongInt) : LongBool;
   231 function  lua_checkstack(L : Plua_State; sz : LongInt) : LongBool;
   221     cdecl; external LuaLibName;
   232     cdecl; external LuaLibName;
   222 
   233 
   223 procedure lua_xmove(src, dest : Plua_State; n : LongInt);
   234 procedure lua_xmove(src, dest : Plua_State; n : LongInt);
   224     cdecl; external LuaLibName;
   235     cdecl; external LuaLibName;
   227 (*
   238 (*
   228 ** access functions (stack -> C)
   239 ** access functions (stack -> C)
   229 *)
   240 *)
   230 function lua_isnumber(L : Plua_State; idx : LongInt) : LongBool;
   241 function lua_isnumber(L : Plua_State; idx : LongInt) : LongBool;
   231     cdecl; external LuaLibName;
   242     cdecl; external LuaLibName;
   232     
   243 
   233 function lua_isstring(L : Plua_State; idx : LongInt) : LongBool;
   244 function lua_isstring(L : Plua_State; idx : LongInt) : LongBool;
   234     cdecl; external LuaLibName;
   245     cdecl; external LuaLibName;
   235     
   246 
   236 function lua_iscfunction(L : Plua_State; idx : LongInt) : LongBool;
   247 function lua_iscfunction(L : Plua_State; idx : LongInt) : LongBool;
   237     cdecl; external LuaLibName;
   248     cdecl; external LuaLibName;
   238     
   249 
   239 function lua_isuserdata(L : Plua_State; idx : LongInt) : LongBool;
   250 function lua_isuserdata(L : Plua_State; idx : LongInt) : LongBool;
   240     cdecl; external LuaLibName;
   251     cdecl; external LuaLibName;
   241     
   252 
   242 function lua_type(L : Plua_State; idx : LongInt) : LongInt;
   253 function lua_type(L : Plua_State; idx : LongInt) : LongInt;
   243     cdecl; external LuaLibName;
   254     cdecl; external LuaLibName;
   244     
   255 
   245 function lua_typename(L : Plua_State; tp : LongInt) : PChar;
   256 function lua_typename(L : Plua_State; tp : LongInt) : PChar;
   246     cdecl; external LuaLibName;
   257     cdecl; external LuaLibName;
   247 
   258 
   248     
       
   249 function lua_equal(L : Plua_State; idx1, idx2 : LongInt) : LongBool;
   259 function lua_equal(L : Plua_State; idx1, idx2 : LongInt) : LongBool;
   250     cdecl; external LuaLibName;
   260     cdecl; external LuaLibName;
   251     
   261 
   252 function lua_rawequal(L : Plua_State; idx1, idx2 : LongInt) : LongBool;
   262 function lua_rawequal(L : Plua_State; idx1, idx2 : LongInt) : LongBool;
   253     cdecl; external LuaLibName;
   263     cdecl; external LuaLibName;
   254     
   264 
   255 function lua_lessthan(L : Plua_State; idx1, idx2 : LongInt) : LongBool;
   265 function lua_lessthan(L : Plua_State; idx1, idx2 : LongInt) : LongBool;
   256     cdecl; external LuaLibName;
   266     cdecl; external LuaLibName;
   257 
   267 
   258 function lua_tonumber(L : Plua_State; idx : LongInt) : lua_Number;
   268 function lua_tonumber(L : Plua_State; idx : LongInt) : lua_Number;
   259     cdecl; external LuaLibName;
   269     cdecl; external LuaLibName;
   260     
   270 
   261 function lua_tointeger(L : Plua_State; idx : LongInt) : lua_Integer;
   271 function lua_tointeger(L : Plua_State; idx : LongInt) : lua_Integer;
   262     cdecl; external LuaLibName;
   272     cdecl; external LuaLibName;
   263     
   273 
   264 function lua_toboolean(L : Plua_State; idx : LongInt) : LongBool;
   274 function lua_toboolean(L : Plua_State; idx : LongInt) : LongBool;
   265     cdecl; external LuaLibName;
   275     cdecl; external LuaLibName;
   266     
   276 
   267     
       
   268 function lua_tolstring(L : Plua_State; idx : LongInt; len : Psize_t) : PChar;
   277 function lua_tolstring(L : Plua_State; idx : LongInt; len : Psize_t) : PChar;
   269     cdecl; external LuaLibName;
   278     cdecl; external LuaLibName;
   270     
   279 
   271 function lua_objlen(L : Plua_State; idx : LongInt) : size_t;
   280 function lua_objlen(L : Plua_State; idx : LongInt) : size_t;
   272     cdecl; external LuaLibName;
   281     cdecl; external LuaLibName;
   273     
   282 
   274 function lua_tocfunction(L : Plua_State; idx : LongInt) : lua_CFunction;
   283 function lua_tocfunction(L : Plua_State; idx : LongInt) : lua_CFunction;
   275     cdecl; external LuaLibName;
   284     cdecl; external LuaLibName;
   276     
   285 
   277 function lua_touserdata(L : Plua_State; idx : LongInt) : Pointer;
   286 function lua_touserdata(L : Plua_State; idx : LongInt) : Pointer;
   278     cdecl; external LuaLibName;
   287     cdecl; external LuaLibName;
   279     
   288 
   280 function lua_tothread(L : Plua_State; idx : LongInt) : Plua_State;
   289 function lua_tothread(L : Plua_State; idx : LongInt) : Plua_State;
   281     cdecl; external LuaLibName;
   290     cdecl; external LuaLibName;
   282     
   291 
   283 function lua_topointer(L : Plua_State; idx : LongInt) : Pointer;
   292 function lua_topointer(L : Plua_State; idx : LongInt) : Pointer;
   284     cdecl; external LuaLibName;
   293     cdecl; external LuaLibName;
   285 
   294 
   286 
   295 
   287 (*
   296 (*
   288 ** push functions (C -> stack)
   297 ** push functions (C -> stack)
   289 *)
   298 *)
   290 procedure lua_pushnil(L : Plua_State);
   299 procedure lua_pushnil(L : Plua_State);
   291     cdecl; external LuaLibName;
   300     cdecl; external LuaLibName;
   292     
   301 
   293 procedure lua_pushnumber(L : Plua_State; n : lua_Number);
   302 procedure lua_pushnumber(L : Plua_State; n : lua_Number);
   294     cdecl; external LuaLibName;
   303     cdecl; external LuaLibName;
   295     
   304 
   296 procedure lua_pushinteger(L : Plua_State; n : lua_Integer);
   305 procedure lua_pushinteger(L : Plua_State; n : lua_Integer);
   297     cdecl; external LuaLibName;
   306     cdecl; external LuaLibName;
   298     
   307 
   299 procedure lua_pushlstring(L : Plua_State; const s : PChar; ls : size_t);
   308 procedure lua_pushlstring(L : Plua_State; const s : PChar; ls : size_t);
   300     cdecl; external LuaLibName;
   309     cdecl; external LuaLibName;
   301     
   310 
   302 procedure lua_pushstring(L : Plua_State; const s : PChar);
   311 procedure lua_pushstring(L : Plua_State; const s : PChar);
   303     cdecl; external LuaLibName;
   312     cdecl; external LuaLibName;
   304     
   313 
   305     
       
   306 function  lua_pushvfstring(L : Plua_State;
   314 function  lua_pushvfstring(L : Plua_State;
   307     const fmt : PChar; argp : Pointer) : PChar;
   315     const fmt : PChar; argp : Pointer) : PChar;
   308     cdecl; external LuaLibName;
   316     cdecl; external LuaLibName;
   309     
   317 
   310 function  lua_pushfstring(L : Plua_State; const fmt : PChar) : PChar; varargs;
   318 function  lua_pushfstring(L : Plua_State; const fmt : PChar) : PChar; varargs;
   311     cdecl; external LuaLibName;
   319     cdecl; external LuaLibName;
   312     
   320 
   313 procedure lua_pushcclosure(L : Plua_State; fn : lua_CFunction; n : LongInt);
   321 procedure lua_pushcclosure(L : Plua_State; fn : lua_CFunction; n : LongInt);
   314     cdecl; external LuaLibName;
   322     cdecl; external LuaLibName;
   315     
   323 
   316 procedure lua_pushboolean(L : Plua_State; b : LongBool);
   324 procedure lua_pushboolean(L : Plua_State; b : LongBool);
   317     cdecl; external LuaLibName;
   325     cdecl; external LuaLibName;
   318     
   326 
   319 procedure lua_pushlightuserdata(L : Plua_State; p : Pointer);
   327 procedure lua_pushlightuserdata(L : Plua_State; p : Pointer);
   320     cdecl; external LuaLibName;
   328     cdecl; external LuaLibName;
   321     
   329 
   322 function  lua_pushthread(L : Plua_state) : Cardinal;
   330 function  lua_pushthread(L : Plua_state) : Cardinal;
   323     cdecl; external LuaLibName;
   331     cdecl; external LuaLibName;
   324 
   332 
   325 
   333 
   326 (*
   334 (*
   327 ** get functions (Lua -> stack)
   335 ** get functions (Lua -> stack)
   328 *)
   336 *)
   329 procedure lua_gettable(L : Plua_State ; idx : LongInt);
   337 procedure lua_gettable(L : Plua_State ; idx : LongInt);
   330     cdecl; external LuaLibName;
   338     cdecl; external LuaLibName;
   331     
   339 
   332 procedure lua_getfield(L : Plua_State; idx : LongInt; k : PChar);
   340 procedure lua_getfield(L : Plua_State; idx : LongInt; k : PChar);
   333     cdecl; external LuaLibName;
   341     cdecl; external LuaLibName;
   334     
   342 
   335 procedure lua_rawget(L : Plua_State; idx : LongInt);
   343 procedure lua_rawget(L : Plua_State; idx : LongInt);
   336     cdecl; external LuaLibName;
   344     cdecl; external LuaLibName;
   337     
   345 
   338 procedure lua_rawgeti(L : Plua_State; idx, n : LongInt);
   346 procedure lua_rawgeti(L : Plua_State; idx, n : LongInt);
   339     cdecl; external LuaLibName;
   347     cdecl; external LuaLibName;
   340     
   348 
   341 procedure lua_createtable(L : Plua_State; narr, nrec : LongInt);
   349 procedure lua_createtable(L : Plua_State; narr, nrec : LongInt);
   342     cdecl; external LuaLibName;
   350     cdecl; external LuaLibName;
   343     
   351 
   344 function  lua_newuserdata(L : Plua_State; sz : size_t) : Pointer;
   352 function  lua_newuserdata(L : Plua_State; sz : size_t) : Pointer;
   345     cdecl; external LuaLibName;
   353     cdecl; external LuaLibName;
   346     
   354 
   347 function  lua_getmetatable(L : Plua_State; objindex : LongInt) : LongBool;
   355 function  lua_getmetatable(L : Plua_State; objindex : LongInt) : LongBool;
   348     cdecl; external LuaLibName;
   356     cdecl; external LuaLibName;
   349     
   357 
   350 procedure lua_getfenv(L : Plua_State; idx : LongInt);
   358 procedure lua_getfenv(L : Plua_State; idx : LongInt);
   351     cdecl; external LuaLibName;
   359     cdecl; external LuaLibName;
   352 
   360 
   353 
   361 
   354 (*
   362 (*
   355 ** set functions (stack -> Lua)
   363 ** set functions (stack -> Lua)
   356 *)
   364 *)
   357 procedure lua_settable(L : Plua_State; idx : LongInt);
   365 procedure lua_settable(L : Plua_State; idx : LongInt);
   358     cdecl; external LuaLibName;
   366     cdecl; external LuaLibName;
   359     
   367 
   360 procedure lua_setfield(L : Plua_State; idx : LongInt; const k : PChar);
   368 procedure lua_setfield(L : Plua_State; idx : LongInt; const k : PChar);
   361     cdecl; external LuaLibName;
   369     cdecl; external LuaLibName;
   362     
   370 
   363 procedure lua_rawset(L : Plua_State; idx : LongInt);
   371 procedure lua_rawset(L : Plua_State; idx : LongInt);
   364     cdecl; external LuaLibName;
   372     cdecl; external LuaLibName;
   365     
   373 
   366 procedure lua_rawseti(L : Plua_State; idx , n: LongInt);
   374 procedure lua_rawseti(L : Plua_State; idx , n: LongInt);
   367     cdecl; external LuaLibName;
   375     cdecl; external LuaLibName;
   368     
   376 
   369 function lua_setmetatable(L : Plua_State; objindex : LongInt): LongBool;
   377 function lua_setmetatable(L : Plua_State; objindex : LongInt): LongBool;
   370     cdecl; external LuaLibName;
   378     cdecl; external LuaLibName;
   371     
   379 
   372 function lua_setfenv(L : Plua_State; idx : LongInt): LongBool;
   380 function lua_setfenv(L : Plua_State; idx : LongInt): LongBool;
   373     cdecl; external LuaLibName;
   381     cdecl; external LuaLibName;
   374 
   382 
   375 (*
   383 (*
   376 ** `load' and `call' functions (load and run Lua code)
   384 ** `load' and `call' functions (load and run Lua code)
   377 *)
   385 *)
   378 procedure lua_call(L : Plua_State; nargs, nresults : LongInt);
   386 procedure lua_call(L : Plua_State; nargs, nresults : LongInt);
   379     cdecl; external LuaLibName;
   387     cdecl; external LuaLibName;
   380     
   388 
   381 function  lua_pcall(L : Plua_State; nargs, nresults, errfunc : LongInt) : LongInt;
   389 function  lua_pcall(L : Plua_State; nargs, nresults, errfunc : LongInt) : LongInt;
   382     cdecl; external LuaLibName;
   390     cdecl; external LuaLibName;
   383     
   391 
   384 function  lua_cpcall(L : Plua_State; func : lua_CFunction; ud : Pointer) : LongInt;
   392 function  lua_cpcall(L : Plua_State; func : lua_CFunction; ud : Pointer) : LongInt;
   385     cdecl; external LuaLibName;
   393     cdecl; external LuaLibName;
   386     
   394 
   387 function  lua_load(L : Plua_State; reader : lua_Reader; dt : Pointer; const chunkname : PChar) : LongInt;
   395 function  lua_load(L : Plua_State; reader : lua_Reader; dt : Pointer; const chunkname : PChar) : LongInt;
   388     cdecl; external LuaLibName;
   396     cdecl; external LuaLibName;
   389     
   397 
   390 
   398 
   391 function lua_dump(L : Plua_State; writer : lua_Writer; data: Pointer) : LongInt;
   399 function lua_dump(L : Plua_State; writer : lua_Writer; data: Pointer) : LongInt;
   392     cdecl; external LuaLibName;
   400     cdecl; external LuaLibName;
   393 
   401 
   394 
   402 
   395 (*
   403 (*
   396 ** coroutine functions
   404 ** coroutine functions
   397 *)
   405 *)
   398 function lua_yield(L : Plua_State; nresults : LongInt) : LongInt;
   406 function lua_yield(L : Plua_State; nresults : LongInt) : LongInt;
   399     cdecl; external LuaLibName;
   407     cdecl; external LuaLibName;
   400     
   408 
   401 function lua_resume(L : Plua_State; narg : LongInt) : LongInt;
   409 function lua_resume(L : Plua_State; narg : LongInt) : LongInt;
   402     cdecl; external LuaLibName;
   410     cdecl; external LuaLibName;
   403     
   411 
   404 function lua_status(L : Plua_State) : LongInt;
   412 function lua_status(L : Plua_State) : LongInt;
   405     cdecl; external LuaLibName;
   413     cdecl; external LuaLibName;
   406 
   414 
   407 (*
   415 (*
   408 ** garbage-collection functions and options
   416 ** garbage-collection functions and options
   409 *)
   417 *)
       
   418 
   410 const
   419 const
   411     LUA_GCSTOP       = 0;
   420     LUA_GCSTOP       = 0;
   412     LUA_GCRESTART    = 1;
   421     LUA_GCRESTART    = 1;
   413     LUA_GCCOLLECT    = 2;
   422     LUA_GCCOLLECT    = 2;
   414     LUA_GCCOUNT      = 3;
   423     LUA_GCCOUNT      = 3;
   432 procedure lua_concat(L : Plua_State; n : LongInt);
   441 procedure lua_concat(L : Plua_State; n : LongInt);
   433     cdecl; external LuaLibName;
   442     cdecl; external LuaLibName;
   434 
   443 
   435 function  lua_getallocf(L : Plua_State; ud : PPointer) : lua_Alloc;
   444 function  lua_getallocf(L : Plua_State; ud : PPointer) : lua_Alloc;
   436     cdecl; external LuaLibName;
   445     cdecl; external LuaLibName;
   437     
   446 
   438 procedure lua_setallocf(L : Plua_State; f : lua_Alloc; ud : Pointer);
   447 procedure lua_setallocf(L : Plua_State; f : lua_Alloc; ud : Pointer);
   439     cdecl; external LuaLibName;
   448     cdecl; external LuaLibName;
   440 
   449 
   441 (*
   450 (*
   442 ** ===============================================================
   451 ** ===============================================================
   530   lua_Hook = procedure (L : Plua_State; ar : Plua_Debug); cdecl;
   539   lua_Hook = procedure (L : Plua_State; ar : Plua_Debug); cdecl;
   531 
   540 
   532 
   541 
   533 function lua_getstack(L : Plua_State; level : LongInt; ar : Plua_Debug) : LongInt;
   542 function lua_getstack(L : Plua_State; level : LongInt; ar : Plua_Debug) : LongInt;
   534     cdecl; external LuaLibName;
   543     cdecl; external LuaLibName;
   535     
   544 
   536 function lua_getinfo(L : Plua_State; const what : PChar; ar: Plua_Debug): LongInt;
   545 function lua_getinfo(L : Plua_State; const what : PChar; ar: Plua_Debug): LongInt;
   537     cdecl; external LuaLibName;
   546     cdecl; external LuaLibName;
   538     
   547 
   539 function lua_getlocal(L : Plua_State; ar : Plua_Debug; n : LongInt) : PChar;
   548 function lua_getlocal(L : Plua_State; ar : Plua_Debug; n : LongInt) : PChar;
   540     cdecl; external LuaLibName;
   549     cdecl; external LuaLibName;
   541     
   550 
   542 function lua_setlocal(L : Plua_State; ar : Plua_Debug; n : LongInt) : PChar;
   551 function lua_setlocal(L : Plua_State; ar : Plua_Debug; n : LongInt) : PChar;
   543     cdecl; external LuaLibName;
   552     cdecl; external LuaLibName;
   544     
   553 
   545 function lua_getupvalue(L : Plua_State; funcindex, n : LongInt) : PChar;
   554 function lua_getupvalue(L : Plua_State; funcindex, n : LongInt) : PChar;
   546     cdecl; external LuaLibName;
   555     cdecl; external LuaLibName;
   547     
   556 
   548 function lua_setupvalue(L : Plua_State; funcindex, n : LongInt) : PChar;
   557 function lua_setupvalue(L : Plua_State; funcindex, n : LongInt) : PChar;
   549     cdecl; external LuaLibName;
   558     cdecl; external LuaLibName;
   550 
   559 
   551 function lua_sethook(L : Plua_State; func : lua_Hook; mask, count: LongInt): LongInt;
   560 function lua_sethook(L : Plua_State; func : lua_Hook; mask, count: LongInt): LongInt;
   552     cdecl; external LuaLibName;
   561     cdecl; external LuaLibName;
   553   
   562 
   554 {$IFDEF LUA_GETHOOK}
   563 {$IFDEF LUA_GETHOOK}
   555 function lua_gethook(L : Plua_State) : lua_Hook;
   564 function lua_gethook(L : Plua_State) : lua_Hook;
   556     cdecl; external LuaLibName;
   565     cdecl; external LuaLibName;
   557 {$ENDIF}
   566 {$ENDIF}
   558 
   567 
   559 function lua_gethookmask(L : Plua_State) : LongInt;
   568 function lua_gethookmask(L : Plua_State) : LongInt;
   560     cdecl; external LuaLibName;
   569     cdecl; external LuaLibName;
   561     
   570 
   562 function lua_gethookcount(L : Plua_State) : LongInt;
   571 function lua_gethookcount(L : Plua_State) : LongInt;
   563     cdecl; external LuaLibName;
   572     cdecl; external LuaLibName;
   564 
   573 
   565 
   574 
   566 (*****************************************************************************)
   575 (*****************************************************************************)