hedgewars/LuaPas.pas
changeset 2799 558b29bf00c5
parent 2786 85f6425a4d74
child 2809 b8956af350c1
equal deleted inserted replaced
2798:d48bbe4518e6 2799:558b29bf00c5
    19   lua_State = record end;
    19   lua_State = record end;
    20   Plua_State = ^lua_State;
    20   Plua_State = ^lua_State;
    21 
    21 
    22 const
    22 const
    23 {$IFDEF UNIX}
    23 {$IFDEF UNIX}
    24   LuaDLL = 'lua5.1.so';
    24   LuaLibName = 'lua5.1.so';
    25 //  LuaDLL = 'lua5.1.a';
    25 {$IFDEF DARWIN}
       
    26     LuaLibName = 'lua5.1.a';
       
    27 {$ENDIF}
    26 {$ELSE}
    28 {$ELSE}
    27   LuaDLL = 'lua5.1.dll';
    29   LuaLibName = 'lua5.1.dll';
    28 {$ENDIF}
    30 {$ENDIF}
    29 
    31 
    30 
    32 
    31 (*****************************************************************************)
    33 (*****************************************************************************)
    32 (*                               luaconfig.h                                 *)
    34 (*                               luaconfig.h                                 *)
   184 
   186 
   185 (*
   187 (*
   186 ** state manipulation
   188 ** state manipulation
   187 *)
   189 *)
   188 function  lua_newstate(f : lua_Alloc; ud : Pointer) : Plua_State;
   190 function  lua_newstate(f : lua_Alloc; ud : Pointer) : Plua_State;
   189   cdecl; external LuaDLL;
   191   cdecl; external LuaLibName;
   190 procedure lua_close(L: Plua_State);
   192 procedure lua_close(L: Plua_State);
   191   cdecl; external LuaDLL;
   193   cdecl; external LuaLibName;
   192 function  lua_newthread(L : Plua_State) : Plua_State;
   194 function  lua_newthread(L : Plua_State) : Plua_State;
   193   cdecl; external LuaDLL;
   195   cdecl; external LuaLibName;
   194 
   196 
   195 function  lua_atpanic(L : Plua_State; panicf : lua_CFunction) : lua_CFunction;
   197 function  lua_atpanic(L : Plua_State; panicf : lua_CFunction) : lua_CFunction;
   196   cdecl; external LuaDLL;
   198   cdecl; external LuaLibName;
   197 
   199 
   198 
   200 
   199 (*
   201 (*
   200 ** basic stack manipulation
   202 ** basic stack manipulation
   201 *)
   203 *)
   202 function  lua_gettop(L : Plua_State) : LongInt;
   204 function  lua_gettop(L : Plua_State) : LongInt;
   203   cdecl; external LuaDLL;
   205   cdecl; external LuaLibName;
   204 procedure lua_settop(L : Plua_State; idx : LongInt);
   206 procedure lua_settop(L : Plua_State; idx : LongInt);
   205   cdecl; external LuaDLL;
   207   cdecl; external LuaLibName;
   206 procedure lua_pushvalue(L : Plua_State; idx : LongInt);
   208 procedure lua_pushvalue(L : Plua_State; idx : LongInt);
   207   cdecl; external LuaDLL;
   209   cdecl; external LuaLibName;
   208 procedure lua_remove(L : Plua_State; idx : LongInt);
   210 procedure lua_remove(L : Plua_State; idx : LongInt);
   209   cdecl; external LuaDLL;
   211   cdecl; external LuaLibName;
   210 procedure lua_insert(L : Plua_State; idx : LongInt);
   212 procedure lua_insert(L : Plua_State; idx : LongInt);
   211   cdecl; external LuaDLL;
   213   cdecl; external LuaLibName;
   212 procedure lua_replace(L : Plua_State; idx : LongInt);
   214 procedure lua_replace(L : Plua_State; idx : LongInt);
   213   cdecl; external LuaDLL;
   215   cdecl; external LuaLibName;
   214 function  lua_checkstack(L : Plua_State; sz : LongInt) : LongBool;
   216 function  lua_checkstack(L : Plua_State; sz : LongInt) : LongBool;
   215   cdecl; external LuaDLL;
   217   cdecl; external LuaLibName;
   216 
   218 
   217 procedure lua_xmove(src, dest : Plua_State; n : LongInt);
   219 procedure lua_xmove(src, dest : Plua_State; n : LongInt);
   218   cdecl; external LuaDLL;
   220   cdecl; external LuaLibName;
   219 
   221 
   220 
   222 
   221 (*
   223 (*
   222 ** access functions (stack -> C)
   224 ** access functions (stack -> C)
   223 *)
   225 *)
   224 function lua_isnumber(L : Plua_State; idx : LongInt) : LongBool;
   226 function lua_isnumber(L : Plua_State; idx : LongInt) : LongBool;
   225   cdecl; external LuaDLL;
   227   cdecl; external LuaLibName;
   226 function lua_isstring(L : Plua_State; idx : LongInt) : LongBool;
   228 function lua_isstring(L : Plua_State; idx : LongInt) : LongBool;
   227   cdecl; external LuaDLL;
   229   cdecl; external LuaLibName;
   228 function lua_iscfunction(L : Plua_State; idx : LongInt) : LongBool;
   230 function lua_iscfunction(L : Plua_State; idx : LongInt) : LongBool;
   229   cdecl; external LuaDLL;
   231   cdecl; external LuaLibName;
   230 function lua_isuserdata(L : Plua_State; idx : LongInt) : LongBool;
   232 function lua_isuserdata(L : Plua_State; idx : LongInt) : LongBool;
   231   cdecl; external LuaDLL;
   233   cdecl; external LuaLibName;
   232 function lua_type(L : Plua_State; idx : LongInt) : LongInt;
   234 function lua_type(L : Plua_State; idx : LongInt) : LongInt;
   233   cdecl; external LuaDLL;
   235   cdecl; external LuaLibName;
   234 function lua_typename(L : Plua_State; tp : LongInt) : PChar;
   236 function lua_typename(L : Plua_State; tp : LongInt) : PChar;
   235   cdecl; external LuaDLL;
   237   cdecl; external LuaLibName;
   236 
   238 
   237 function lua_equal(L : Plua_State; idx1, idx2 : LongInt) : LongBool;
   239 function lua_equal(L : Plua_State; idx1, idx2 : LongInt) : LongBool;
   238   cdecl; external LuaDLL;
   240   cdecl; external LuaLibName;
   239 function lua_rawequal(L : Plua_State; idx1, idx2 : LongInt) : LongBool;
   241 function lua_rawequal(L : Plua_State; idx1, idx2 : LongInt) : LongBool;
   240   cdecl; external LuaDLL;
   242   cdecl; external LuaLibName;
   241 function lua_lessthan(L : Plua_State; idx1, idx2 : LongInt) : LongBool;
   243 function lua_lessthan(L : Plua_State; idx1, idx2 : LongInt) : LongBool;
   242   cdecl; external LuaDLL;
   244   cdecl; external LuaLibName;
   243 
   245 
   244 function lua_tonumber(L : Plua_State; idx : LongInt) : lua_Number;
   246 function lua_tonumber(L : Plua_State; idx : LongInt) : lua_Number;
   245   cdecl; external LuaDLL;
   247   cdecl; external LuaLibName;
   246 function lua_tointeger(L : Plua_State; idx : LongInt) : lua_Integer;
   248 function lua_tointeger(L : Plua_State; idx : LongInt) : lua_Integer;
   247   cdecl; external LuaDLL;
   249   cdecl; external LuaLibName;
   248 function lua_toboolean(L : Plua_State; idx : LongInt) : LongBool;
   250 function lua_toboolean(L : Plua_State; idx : LongInt) : LongBool;
   249   cdecl; external LuaDLL;
   251   cdecl; external LuaLibName;
   250 function lua_tolstring(L : Plua_State; idx : LongInt;
   252 function lua_tolstring(L : Plua_State; idx : LongInt;
   251                        len : Psize_t) : PChar;
   253                        len : Psize_t) : PChar;
   252   cdecl; external LuaDLL;
   254   cdecl; external LuaLibName;
   253 function lua_objlen(L : Plua_State; idx : LongInt) : size_t;
   255 function lua_objlen(L : Plua_State; idx : LongInt) : size_t;
   254   cdecl; external LuaDLL;
   256   cdecl; external LuaLibName;
   255 function lua_tocfunction(L : Plua_State; idx : LongInt) : lua_CFunction;
   257 function lua_tocfunction(L : Plua_State; idx : LongInt) : lua_CFunction;
   256   cdecl; external LuaDLL;
   258   cdecl; external LuaLibName;
   257 function lua_touserdata(L : Plua_State; idx : LongInt) : Pointer;
   259 function lua_touserdata(L : Plua_State; idx : LongInt) : Pointer;
   258   cdecl; external LuaDLL;
   260   cdecl; external LuaLibName;
   259 function lua_tothread(L : Plua_State; idx : LongInt) : Plua_State;
   261 function lua_tothread(L : Plua_State; idx : LongInt) : Plua_State;
   260   cdecl; external LuaDLL;
   262   cdecl; external LuaLibName;
   261 function lua_topointer(L : Plua_State; idx : LongInt) : Pointer;
   263 function lua_topointer(L : Plua_State; idx : LongInt) : Pointer;
   262   cdecl; external LuaDLL;
   264   cdecl; external LuaLibName;
   263 
   265 
   264 
   266 
   265 (*
   267 (*
   266 ** push functions (C -> stack)
   268 ** push functions (C -> stack)
   267 *)
   269 *)
   268 procedure lua_pushnil(L : Plua_State);
   270 procedure lua_pushnil(L : Plua_State);
   269   cdecl; external LuaDLL;
   271   cdecl; external LuaLibName;
   270 procedure lua_pushnumber(L : Plua_State; n : lua_Number);
   272 procedure lua_pushnumber(L : Plua_State; n : lua_Number);
   271   cdecl; external LuaDLL;
   273   cdecl; external LuaLibName;
   272 procedure lua_pushinteger(L : Plua_State; n : lua_Integer);
   274 procedure lua_pushinteger(L : Plua_State; n : lua_Integer);
   273   cdecl; external LuaDLL;
   275   cdecl; external LuaLibName;
   274 procedure lua_pushlstring(L : Plua_State; const s : PChar; ls : size_t);
   276 procedure lua_pushlstring(L : Plua_State; const s : PChar; ls : size_t);
   275   cdecl; external LuaDLL;
   277   cdecl; external LuaLibName;
   276 procedure lua_pushstring(L : Plua_State; const s : PChar);
   278 procedure lua_pushstring(L : Plua_State; const s : PChar);
   277   cdecl; external LuaDLL;
   279   cdecl; external LuaLibName;
   278 function  lua_pushvfstring(L : Plua_State;
   280 function  lua_pushvfstring(L : Plua_State;
   279                            const fmt : PChar; argp : Pointer) : PChar;
   281                            const fmt : PChar; argp : Pointer) : PChar;
   280   cdecl; external LuaDLL;
   282   cdecl; external LuaLibName;
   281 function  lua_pushfstring(L : Plua_State; const fmt : PChar) : PChar; varargs;
   283 function  lua_pushfstring(L : Plua_State; const fmt : PChar) : PChar; varargs;
   282   cdecl; external LuaDLL;
   284   cdecl; external LuaLibName;
   283 procedure lua_pushcclosure(L : Plua_State; fn : lua_CFunction; n : LongInt);
   285 procedure lua_pushcclosure(L : Plua_State; fn : lua_CFunction; n : LongInt);
   284   cdecl; external LuaDLL;
   286   cdecl; external LuaLibName;
   285 procedure lua_pushboolean(L : Plua_State; b : LongBool);
   287 procedure lua_pushboolean(L : Plua_State; b : LongBool);
   286   cdecl; external LuaDLL;
   288   cdecl; external LuaLibName;
   287 procedure lua_pushlightuserdata(L : Plua_State; p : Pointer);
   289 procedure lua_pushlightuserdata(L : Plua_State; p : Pointer);
   288   cdecl; external LuaDLL;
   290   cdecl; external LuaLibName;
   289 function  lua_pushthread(L : Plua_state) : Cardinal;
   291 function  lua_pushthread(L : Plua_state) : Cardinal;
   290   cdecl; external LuaDLL;
   292   cdecl; external LuaLibName;
   291 
   293 
   292 
   294 
   293 (*
   295 (*
   294 ** get functions (Lua -> stack)
   296 ** get functions (Lua -> stack)
   295 *)
   297 *)
   296 procedure lua_gettable(L : Plua_State ; idx : LongInt);
   298 procedure lua_gettable(L : Plua_State ; idx : LongInt);
   297   cdecl; external LuaDLL;
   299   cdecl; external LuaLibName;
   298 procedure lua_getfield(L : Plua_State; idx : LongInt; k : PChar);
   300 procedure lua_getfield(L : Plua_State; idx : LongInt; k : PChar);
   299   cdecl; external LuaDLL;
   301   cdecl; external LuaLibName;
   300 procedure lua_rawget(L : Plua_State; idx : LongInt);
   302 procedure lua_rawget(L : Plua_State; idx : LongInt);
   301   cdecl; external LuaDLL;
   303   cdecl; external LuaLibName;
   302 procedure lua_rawgeti(L : Plua_State; idx, n : LongInt);
   304 procedure lua_rawgeti(L : Plua_State; idx, n : LongInt);
   303   cdecl; external LuaDLL;
   305   cdecl; external LuaLibName;
   304 procedure lua_createtable(L : Plua_State; narr, nrec : LongInt);
   306 procedure lua_createtable(L : Plua_State; narr, nrec : LongInt);
   305   cdecl; external LuaDLL;
   307   cdecl; external LuaLibName;
   306 function  lua_newuserdata(L : Plua_State; sz : size_t) : Pointer;
   308 function  lua_newuserdata(L : Plua_State; sz : size_t) : Pointer;
   307   cdecl; external LuaDLL;
   309   cdecl; external LuaLibName;
   308 function  lua_getmetatable(L : Plua_State; objindex : LongInt) : LongBool;
   310 function  lua_getmetatable(L : Plua_State; objindex : LongInt) : LongBool;
   309   cdecl; external LuaDLL;
   311   cdecl; external LuaLibName;
   310 procedure lua_getfenv(L : Plua_State; idx : LongInt);
   312 procedure lua_getfenv(L : Plua_State; idx : LongInt);
   311   cdecl; external LuaDLL;
   313   cdecl; external LuaLibName;
   312 
   314 
   313 
   315 
   314 (*
   316 (*
   315 ** set functions (stack -> Lua)
   317 ** set functions (stack -> Lua)
   316 *)
   318 *)
   317 procedure lua_settable(L : Plua_State; idx : LongInt);
   319 procedure lua_settable(L : Plua_State; idx : LongInt);
   318   cdecl; external LuaDLL;
   320   cdecl; external LuaLibName;
   319 procedure lua_setfield(L : Plua_State; idx : LongInt; const k : PChar);
   321 procedure lua_setfield(L : Plua_State; idx : LongInt; const k : PChar);
   320   cdecl; external LuaDLL;
   322   cdecl; external LuaLibName;
   321 procedure lua_rawset(L : Plua_State; idx : LongInt);
   323 procedure lua_rawset(L : Plua_State; idx : LongInt);
   322   cdecl; external LuaDLL;
   324   cdecl; external LuaLibName;
   323 procedure lua_rawseti(L : Plua_State; idx , n: LongInt);
   325 procedure lua_rawseti(L : Plua_State; idx , n: LongInt);
   324   cdecl; external LuaDLL;
   326   cdecl; external LuaLibName;
   325 function lua_setmetatable(L : Plua_State; objindex : LongInt): LongBool;
   327 function lua_setmetatable(L : Plua_State; objindex : LongInt): LongBool;
   326   cdecl; external LuaDLL;
   328   cdecl; external LuaLibName;
   327 function lua_setfenv(L : Plua_State; idx : LongInt): LongBool;
   329 function lua_setfenv(L : Plua_State; idx : LongInt): LongBool;
   328   cdecl; external LuaDLL;
   330   cdecl; external LuaLibName;
   329 
   331 
   330 (*
   332 (*
   331 ** `load' and `call' functions (load and run Lua code)
   333 ** `load' and `call' functions (load and run Lua code)
   332 *)
   334 *)
   333 procedure lua_call(L : Plua_State; nargs, nresults : LongInt);
   335 procedure lua_call(L : Plua_State; nargs, nresults : LongInt);
   334   cdecl; external LuaDLL;
   336   cdecl; external LuaLibName;
   335 function  lua_pcall(L : Plua_State;
   337 function  lua_pcall(L : Plua_State;
   336                     nargs, nresults, errfunc : LongInt) : LongInt;
   338                     nargs, nresults, errfunc : LongInt) : LongInt;
   337   cdecl; external LuaDLL;
   339   cdecl; external LuaLibName;
   338 function  lua_cpcall(L : Plua_State;
   340 function  lua_cpcall(L : Plua_State;
   339                      func : lua_CFunction; ud : Pointer) : LongInt;
   341                      func : lua_CFunction; ud : Pointer) : LongInt;
   340   cdecl; external LuaDLL;
   342   cdecl; external LuaLibName;
   341 function  lua_load(L : Plua_State; reader : lua_Reader;
   343 function  lua_load(L : Plua_State; reader : lua_Reader;
   342                    dt : Pointer; const chunkname : PChar) : LongInt;
   344                    dt : Pointer; const chunkname : PChar) : LongInt;
   343   cdecl; external LuaDLL;
   345   cdecl; external LuaLibName;
   344 
   346 
   345 function lua_dump(L : Plua_State; writer : lua_Writer; data: Pointer) : LongInt;
   347 function lua_dump(L : Plua_State; writer : lua_Writer; data: Pointer) : LongInt;
   346   cdecl; external LuaDLL;
   348   cdecl; external LuaLibName;
   347 
   349 
   348 
   350 
   349 (*
   351 (*
   350 ** coroutine functions
   352 ** coroutine functions
   351 *)
   353 *)
   352 function lua_yield(L : Plua_State; nresults : LongInt) : LongInt;
   354 function lua_yield(L : Plua_State; nresults : LongInt) : LongInt;
   353   cdecl; external LuaDLL;
   355   cdecl; external LuaLibName;
   354 function lua_resume(L : Plua_State; narg : LongInt) : LongInt;
   356 function lua_resume(L : Plua_State; narg : LongInt) : LongInt;
   355   cdecl; external LuaDLL;
   357   cdecl; external LuaLibName;
   356 function lua_status(L : Plua_State) : LongInt;
   358 function lua_status(L : Plua_State) : LongInt;
   357   cdecl; external LuaDLL;
   359   cdecl; external LuaLibName;
   358 
   360 
   359 (*
   361 (*
   360 ** garbage-collection functions and options
   362 ** garbage-collection functions and options
   361 *)
   363 *)
   362 const
   364 const
   368   LUA_GCSTEP       = 5;
   370   LUA_GCSTEP       = 5;
   369   LUA_GCSETPAUSE   = 6;
   371   LUA_GCSETPAUSE   = 6;
   370   LUA_GCSETSTEPMUL = 7;
   372   LUA_GCSETSTEPMUL = 7;
   371 
   373 
   372 function lua_gc(L : Plua_State; what, data : LongInt) : LongInt;
   374 function lua_gc(L : Plua_State; what, data : LongInt) : LongInt;
   373   cdecl; external LuaDLL;
   375   cdecl; external LuaLibName;
   374 
   376 
   375 (*
   377 (*
   376 ** miscellaneous functions
   378 ** miscellaneous functions
   377 *)
   379 *)
   378 function lua_error(L : Plua_State) : LongInt;
   380 function lua_error(L : Plua_State) : LongInt;
   379   cdecl; external LuaDLL;
   381   cdecl; external LuaLibName;
   380 
   382 
   381 function lua_next(L : Plua_State; idx : LongInt) : LongInt;
   383 function lua_next(L : Plua_State; idx : LongInt) : LongInt;
   382   cdecl; external LuaDLL;
   384   cdecl; external LuaLibName;
   383 
   385 
   384 procedure lua_concat(L : Plua_State; n : LongInt);
   386 procedure lua_concat(L : Plua_State; n : LongInt);
   385   cdecl; external LuaDLL;
   387   cdecl; external LuaLibName;
   386 
   388 
   387 function  lua_getallocf(L : Plua_State; ud : PPointer) : lua_Alloc;
   389 function  lua_getallocf(L : Plua_State; ud : PPointer) : lua_Alloc;
   388   cdecl; external LuaDLL;
   390   cdecl; external LuaLibName;
   389 procedure lua_setallocf(L : Plua_State; f : lua_Alloc; ud : Pointer);
   391 procedure lua_setallocf(L : Plua_State; f : lua_Alloc; ud : Pointer);
   390   cdecl; external LuaDLL;
   392   cdecl; external LuaLibName;
   391 
   393 
   392 (*
   394 (*
   393 ** ===============================================================
   395 ** ===============================================================
   394 ** some useful macros
   396 ** some useful macros
   395 ** ===============================================================
   397 ** ===============================================================
   481   lua_Hook = procedure (L : Plua_State; ar : Plua_Debug); cdecl;
   483   lua_Hook = procedure (L : Plua_State; ar : Plua_Debug); cdecl;
   482 
   484 
   483 
   485 
   484 function lua_getstack(L : Plua_State; level : LongInt;
   486 function lua_getstack(L : Plua_State; level : LongInt;
   485                       ar : Plua_Debug) : LongInt;
   487                       ar : Plua_Debug) : LongInt;
   486   cdecl; external LuaDLL;
   488   cdecl; external LuaLibName;
   487 function lua_getinfo(L : Plua_State; const what : PChar;
   489 function lua_getinfo(L : Plua_State; const what : PChar;
   488                      ar: Plua_Debug): LongInt;
   490                      ar: Plua_Debug): LongInt;
   489   cdecl; external LuaDLL;
   491   cdecl; external LuaLibName;
   490 function lua_getlocal(L : Plua_State;
   492 function lua_getlocal(L : Plua_State;
   491                       ar : Plua_Debug; n : LongInt) : PChar;
   493                       ar : Plua_Debug; n : LongInt) : PChar;
   492   cdecl; external LuaDLL;
   494   cdecl; external LuaLibName;
   493 function lua_setlocal(L : Plua_State;
   495 function lua_setlocal(L : Plua_State;
   494                       ar : Plua_Debug; n : LongInt) : PChar;
   496                       ar : Plua_Debug; n : LongInt) : PChar;
   495   cdecl; external LuaDLL;
   497   cdecl; external LuaLibName;
   496 function lua_getupvalue(L : Plua_State; funcindex, n : LongInt) : PChar;
   498 function lua_getupvalue(L : Plua_State; funcindex, n : LongInt) : PChar;
   497   cdecl; external LuaDLL;
   499   cdecl; external LuaLibName;
   498 function lua_setupvalue(L : Plua_State; funcindex, n : LongInt) : PChar;
   500 function lua_setupvalue(L : Plua_State; funcindex, n : LongInt) : PChar;
   499   cdecl; external LuaDLL;
   501   cdecl; external LuaLibName;
   500 
   502 
   501 function lua_sethook(L : Plua_State; func : lua_Hook;
   503 function lua_sethook(L : Plua_State; func : lua_Hook;
   502                      mask, count: LongInt): LongInt;
   504                      mask, count: LongInt): LongInt;
   503   cdecl; external LuaDLL;
   505   cdecl; external LuaLibName;
   504 {$IFDEF LUA_GETHOOK}
   506 {$IFDEF LUA_GETHOOK}
   505 function lua_gethook(L : Plua_State) : lua_Hook;
   507 function lua_gethook(L : Plua_State) : lua_Hook;
   506   cdecl; external LuaDLL;
   508   cdecl; external LuaLibName;
   507 {$ENDIF}
   509 {$ENDIF}
   508 
   510 
   509 function lua_gethookmask(L : Plua_State) : LongInt;
   511 function lua_gethookmask(L : Plua_State) : LongInt;
   510   cdecl; external LuaDLL;
   512   cdecl; external LuaLibName;
   511 function lua_gethookcount(L : Plua_State) : LongInt;
   513 function lua_gethookcount(L : Plua_State) : LongInt;
   512   cdecl; external LuaDLL;
   514   cdecl; external LuaLibName;
   513 
   515 
   514 
   516 
   515 (*****************************************************************************)
   517 (*****************************************************************************)
   516 (*                                  lualib.h                                 *)
   518 (*                                  lualib.h                                 *)
   517 (*****************************************************************************)
   519 (*****************************************************************************)
   534   LUA_MATHLIBNAME = 'math';
   536   LUA_MATHLIBNAME = 'math';
   535   LUA_DBLIBNAME   = 'debug';
   537   LUA_DBLIBNAME   = 'debug';
   536   LUA_LOADLIBNAME = 'package';
   538   LUA_LOADLIBNAME = 'package';
   537 
   539 
   538 function luaopen_base(L : Plua_State) : LongInt;
   540 function luaopen_base(L : Plua_State) : LongInt;
   539   cdecl; external LuaDLL;
   541   cdecl; external LuaLibName;
   540 
   542 
   541 function luaopen_table(L : Plua_State) : LongInt;
   543 function luaopen_table(L : Plua_State) : LongInt;
   542   cdecl; external LuaDLL;
   544   cdecl; external LuaLibName;
   543 
   545 
   544 function luaopen_io(L : Plua_State) : LongInt;
   546 function luaopen_io(L : Plua_State) : LongInt;
   545   cdecl; external LuaDLL;
   547   cdecl; external LuaLibName;
   546 
   548 
   547 function luaopen_os(L : Plua_State) : LongInt;
   549 function luaopen_os(L : Plua_State) : LongInt;
   548   cdecl; external LuaDLL;
   550   cdecl; external LuaLibName;
   549 
   551 
   550 function luaopen_string(L : Plua_State) : LongInt;
   552 function luaopen_string(L : Plua_State) : LongInt;
   551   cdecl; external LuaDLL;
   553   cdecl; external LuaLibName;
   552 
   554 
   553 function luaopen_math(L : Plua_State) : LongInt;
   555 function luaopen_math(L : Plua_State) : LongInt;
   554   cdecl; external LuaDLL;
   556   cdecl; external LuaLibName;
   555 
   557 
   556 function luaopen_debug(L : Plua_State) : LongInt;
   558 function luaopen_debug(L : Plua_State) : LongInt;
   557   cdecl; external LuaDLL;
   559   cdecl; external LuaLibName;
   558 
   560 
   559 function luaopen_package(L : Plua_State) : LongInt;
   561 function luaopen_package(L : Plua_State) : LongInt;
   560   cdecl; external LuaDLL;
   562   cdecl; external LuaLibName;
   561 
   563 
   562 procedure luaL_openlibs(L : Plua_State);
   564 procedure luaL_openlibs(L : Plua_State);
   563   cdecl; external LuaDLL;
   565   cdecl; external LuaLibName;
   564 
   566 
   565 procedure lua_assert(x : Boolean);    // a macro
   567 procedure lua_assert(x : Boolean);    // a macro
   566 
   568 
   567 
   569 
   568 (*****************************************************************************)
   570 (*****************************************************************************)
   590   PluaL_Reg = ^luaL_Reg;
   592   PluaL_Reg = ^luaL_Reg;
   591 
   593 
   592 
   594 
   593 procedure luaL_openlib(L : Plua_State; const libname : PChar;
   595 procedure luaL_openlib(L : Plua_State; const libname : PChar;
   594                        const lr : PluaL_Reg; nup : LongInt);
   596                        const lr : PluaL_Reg; nup : LongInt);
   595   cdecl; external LuaDLL;
   597   cdecl; external LuaLibName;
   596 procedure luaL_register(L : Plua_State; const libname : PChar;
   598 procedure luaL_register(L : Plua_State; const libname : PChar;
   597                        const lr : PluaL_Reg);
   599                        const lr : PluaL_Reg);
   598   cdecl; external LuaDLL;
   600   cdecl; external LuaLibName;
   599 function luaL_getmetafield(L : Plua_State; obj : LongInt;
   601 function luaL_getmetafield(L : Plua_State; obj : LongInt;
   600                            const e : PChar) : LongInt;
   602                            const e : PChar) : LongInt;
   601   cdecl; external LuaDLL;
   603   cdecl; external LuaLibName;
   602 function luaL_callmeta(L : Plua_State; obj : LongInt;
   604 function luaL_callmeta(L : Plua_State; obj : LongInt;
   603                        const e : PChar) : LongInt;
   605                        const e : PChar) : LongInt;
   604   cdecl; external LuaDLL;
   606   cdecl; external LuaLibName;
   605 function luaL_typerror(L : Plua_State; narg : LongInt;
   607 function luaL_typerror(L : Plua_State; narg : LongInt;
   606                        const tname : PChar) : LongInt;
   608                        const tname : PChar) : LongInt;
   607   cdecl; external LuaDLL;
   609   cdecl; external LuaLibName;
   608 function luaL_argerror(L : Plua_State; numarg : LongInt;
   610 function luaL_argerror(L : Plua_State; numarg : LongInt;
   609                        const extramsg : PChar) : LongInt;
   611                        const extramsg : PChar) : LongInt;
   610   cdecl; external LuaDLL;
   612   cdecl; external LuaLibName;
   611 function luaL_checklstring(L : Plua_State; numArg : LongInt;
   613 function luaL_checklstring(L : Plua_State; numArg : LongInt;
   612                            ls : Psize_t) : PChar;
   614                            ls : Psize_t) : PChar;
   613   cdecl; external LuaDLL;
   615   cdecl; external LuaLibName;
   614 function luaL_optlstring(L : Plua_State; numArg : LongInt;
   616 function luaL_optlstring(L : Plua_State; numArg : LongInt;
   615                          const def: PChar; ls: Psize_t) : PChar;
   617                          const def: PChar; ls: Psize_t) : PChar;
   616   cdecl; external LuaDLL;
   618   cdecl; external LuaLibName;
   617 function luaL_checknumber(L : Plua_State; numArg : LongInt) : lua_Number;
   619 function luaL_checknumber(L : Plua_State; numArg : LongInt) : lua_Number;
   618   cdecl; external LuaDLL;
   620   cdecl; external LuaLibName;
   619 function luaL_optnumber(L : Plua_State; nArg : LongInt;
   621 function luaL_optnumber(L : Plua_State; nArg : LongInt;
   620                         def : lua_Number) : lua_Number;
   622                         def : lua_Number) : lua_Number;
   621   cdecl; external LuaDLL;
   623   cdecl; external LuaLibName;
   622 
   624 
   623 function luaL_checkinteger(L : Plua_State; numArg : LongInt) : lua_Integer;
   625 function luaL_checkinteger(L : Plua_State; numArg : LongInt) : lua_Integer;
   624   cdecl; external LuaDLL;
   626   cdecl; external LuaLibName;
   625 function luaL_optinteger(L : Plua_State; nArg : LongInt;
   627 function luaL_optinteger(L : Plua_State; nArg : LongInt;
   626                         def : lua_Integer) : lua_Integer;
   628                         def : lua_Integer) : lua_Integer;
   627   cdecl; external LuaDLL;
   629   cdecl; external LuaLibName;
   628 
   630 
   629 procedure luaL_checkstack(L : Plua_State; sz : LongInt; const msg : PChar);
   631 procedure luaL_checkstack(L : Plua_State; sz : LongInt; const msg : PChar);
   630   cdecl; external LuaDLL;
   632   cdecl; external LuaLibName;
   631 procedure luaL_checktype(L : Plua_State; narg, t : LongInt);
   633 procedure luaL_checktype(L : Plua_State; narg, t : LongInt);
   632   cdecl; external LuaDLL;
   634   cdecl; external LuaLibName;
   633 procedure luaL_checkany(L : Plua_State; narg : LongInt);
   635 procedure luaL_checkany(L : Plua_State; narg : LongInt);
   634   cdecl; external LuaDLL;
   636   cdecl; external LuaLibName;
   635 
   637 
   636 function luaL_newmetatable(L : Plua_State; const tname : PChar) : LongInt;
   638 function luaL_newmetatable(L : Plua_State; const tname : PChar) : LongInt;
   637   cdecl; external LuaDLL;
   639   cdecl; external LuaLibName;
   638 function luaL_checkudata(L : Plua_State; ud : LongInt;
   640 function luaL_checkudata(L : Plua_State; ud : LongInt;
   639                          const tname : PChar) : Pointer;
   641                          const tname : PChar) : Pointer;
   640   cdecl; external LuaDLL;
   642   cdecl; external LuaLibName;
   641 
   643 
   642 procedure luaL_where(L : Plua_State; lvl : LongInt);
   644 procedure luaL_where(L : Plua_State; lvl : LongInt);
   643   cdecl; external LuaDLL;
   645   cdecl; external LuaLibName;
   644 function  luaL_error(L : Plua_State; const fmt : PChar) : LongInt; varargs;
   646 function  luaL_error(L : Plua_State; const fmt : PChar) : LongInt; varargs;
   645   cdecl; external LuaDLL;
   647   cdecl; external LuaLibName;
   646 
   648 
   647 function luaL_checkoption(L : Plua_State; narg : LongInt; const def : PChar;
   649 function luaL_checkoption(L : Plua_State; narg : LongInt; const def : PChar;
   648                           const lst : array of PChar) : LongInt;
   650                           const lst : array of PChar) : LongInt;
   649   cdecl; external LuaDLL;
   651   cdecl; external LuaLibName;
   650 
   652 
   651 function  luaL_ref(L : Plua_State; t : LongInt) : LongInt;
   653 function  luaL_ref(L : Plua_State; t : LongInt) : LongInt;
   652   cdecl; external LuaDLL;
   654   cdecl; external LuaLibName;
   653 procedure luaL_unref(L : Plua_State; t, ref : LongInt);
   655 procedure luaL_unref(L : Plua_State; t, ref : LongInt);
   654   cdecl; external LuaDLL;
   656   cdecl; external LuaLibName;
   655 
   657 
   656 function luaL_loadfile(L : Plua_State; const filename : PChar) : LongInt;
   658 function luaL_loadfile(L : Plua_State; const filename : PChar) : LongInt;
   657   cdecl; external LuaDLL;
   659   cdecl; external LuaLibName;
   658 function luaL_loadbuffer(L : Plua_State; const buff : PChar;
   660 function luaL_loadbuffer(L : Plua_State; const buff : PChar;
   659                          sz : size_t; const name: PChar) : LongInt;
   661                          sz : size_t; const name: PChar) : LongInt;
   660   cdecl; external LuaDLL;
   662   cdecl; external LuaLibName;
   661 
   663 
   662 function luaL_loadstring(L : Plua_State; const s : Pchar) : LongInt;
   664 function luaL_loadstring(L : Plua_State; const s : Pchar) : LongInt;
   663   cdecl; external LuaDLL;
   665   cdecl; external LuaLibName;
   664 
   666 
   665 function luaL_newstate : Plua_State;
   667 function luaL_newstate : Plua_State;
   666   cdecl; external LuaDLL;
   668   cdecl; external LuaLibName;
   667 
   669 
   668 function luaL_gsub(L : Plua_State; const s, p, r : PChar) : PChar;
   670 function luaL_gsub(L : Plua_State; const s, p, r : PChar) : PChar;
   669   cdecl; external LuaDLL;
   671   cdecl; external LuaLibName;
   670 
   672 
   671 function luaL_findtable(L : Plua_State; idx : LongInt;
   673 function luaL_findtable(L : Plua_State; idx : LongInt;
   672                         const fname : PChar; szhint : LongInt) : PChar;
   674                         const fname : PChar; szhint : LongInt) : PChar;
   673   cdecl; external LuaDLL;
   675   cdecl; external LuaLibName;
   674 
   676 
   675 
   677 
   676 (*
   678 (*
   677 ** ===============================================================
   679 ** ===============================================================
   678 ** some useful macros
   680 ** some useful macros
   721 procedure luaL_putchar(B : PluaL_Buffer; c : Char);
   723 procedure luaL_putchar(B : PluaL_Buffer; c : Char);
   722 
   724 
   723 procedure luaL_addsize(B : PluaL_Buffer; n : LongInt);
   725 procedure luaL_addsize(B : PluaL_Buffer; n : LongInt);
   724 
   726 
   725 procedure luaL_buffinit(L : Plua_State; B : PluaL_Buffer);
   727 procedure luaL_buffinit(L : Plua_State; B : PluaL_Buffer);
   726   cdecl; external LuaDLL;
   728   cdecl; external LuaLibName;
   727 function  luaL_prepbuffer(B : PluaL_Buffer) : PChar;
   729 function  luaL_prepbuffer(B : PluaL_Buffer) : PChar;
   728   cdecl; external LuaDLL;
   730   cdecl; external LuaLibName;
   729 procedure luaL_addlstring(B : PluaL_Buffer; const s : PChar; ls : size_t);
   731 procedure luaL_addlstring(B : PluaL_Buffer; const s : PChar; ls : size_t);
   730   cdecl; external LuaDLL;
   732   cdecl; external LuaLibName;
   731 procedure luaL_addstring(B : PluaL_Buffer; const s : PChar);
   733 procedure luaL_addstring(B : PluaL_Buffer; const s : PChar);
   732   cdecl; external LuaDLL;
   734   cdecl; external LuaLibName;
   733 procedure luaL_addvalue(B : PluaL_Buffer);
   735 procedure luaL_addvalue(B : PluaL_Buffer);
   734   cdecl; external LuaDLL;
   736   cdecl; external LuaLibName;
   735 procedure luaL_pushresult(B : PluaL_Buffer);
   737 procedure luaL_pushresult(B : PluaL_Buffer);
   736   cdecl; external LuaDLL;
   738   cdecl; external LuaLibName;
   737 
   739 
   738 (* ====================================================== *)
   740 (* ====================================================== *)
   739 
   741 
   740 
   742 
   741 (* compatibility with ref system *)
   743 (* compatibility with ref system *)