6f99e9c805c3244e3acb411da9191d0afad8c631
1 (******************************************************************************
4 * Authors: TeCGraf (C headers + actual Lua libraries) *
5 * Lavergne Thomas (original translation to Pascal) *
6 * Bram Kuijvenhoven (update to Lua 5.1.1 for FreePascal) *
7 * Description: Basic Lua library *
9 ******************************************************************************)
12 ** $Id: lua.h,v 1.175 2003/03/18 12:31:39 roberto Exp $
13 ** Lua - An Extensible Extension Language
14 ** TeCGraf: Computer Graphics Technology Group, PUC-Rio, Brazil
15 ** http://www.lua.org mailto:info@lua.org
16 ** See Copyright Notice at the end of this file
19 ** Updated to Lua 5.1.1 by Bram Kuijvenhoven (bram at kuijvenhoven dot net),
20 ** Hexis BV (http://www.hexis.nl), the Netherlands
22 ** - Only tested with FPC (FreePascal Compiler)
23 ** - Using LuaBinaries styled DLL/SO names, which include version names
24 ** - LUA_YIELD was suffixed by '_' for avoiding name collision
27 ** Translated to pascal by Lavergne Thomas
29 ** - Pointers type was prefixed with 'P'
30 ** - lua_upvalueindex constant was transformed to function
31 ** - Some compatibility function was isolated because with it you must have
33 ** - LUA_VERSION was suffixed by '_' for avoiding name collision.
35 ** - thomas.lavergne@laposte.net
36 ** In french or in english
39 {$IFDEF FPC}{$MODE OBJFPC}{$H+}{$ENDIF}
47 LUA_NAME
= 'libluajit.so';
48 LUA_LIB_NAME
= 'libluajit.so';
50 LUA_NAME
= 'lua51.dll';
51 LUA_LIB_NAME
= 'lua51.dll';
59 LUA_VERSION
= 'Lua 5.1';
60 LUA_RELEASE
= 'Lua 5.1.1';
61 LUA_VERSION_NUM
= 501;
62 LUA_COPYRIGHT
= 'Copyright (C) 1994-2006 Lua.org, PUC-Rio';
63 LUA_AUTHORS
= 'R. Ierusalimschy, L. H. de Figueiredo & W. Celes';
65 (* option for multiple returns in `lua_pcall' and `lua_call' *)
71 LUA_REGISTRYINDEX
= -10000;
72 LUA_ENVIRONINDEX
= -10001;
73 LUA_GLOBALSINDEX
= -10002;
75 function lua_upvalueindex(I
: Integer): Integer;
78 (* thread status; 0 is OK *)
88 lua_CFunction
= function(L
: Plua_State
): Integer; cdecl;
91 ** functions that read/write blocks when loading/dumping Lua chunks
94 lua_Reader
= function(L
: Plua_State
; ud
: Pointer; sz
: Psize_t
): PChar; cdecl;
95 lua_Writer
= function(L
: Plua_State
; const p
: Pointer; sz
: size_t
; ud
: Pointer): Integer; cdecl;
98 ** prototype for memory-allocation functions
100 lua_Alloc
= function(ud
, ptr
: Pointer; osize
, nsize
: size_t
): Pointer; cdecl;
110 LUA_TLIGHTUSERDATA
= 2;
118 (* minimum Lua stack available to a C function *)
122 (* Type of Numbers in Lua *)
124 lua_Integer
= PtrInt
;
127 ** state manipulation
129 function lua_newstate(f
: lua_Alloc
; ud
: Pointer): Plua_state
; cdecl;
130 procedure lua_close(L
: Plua_State
); cdecl;
131 function lua_newthread(L
: Plua_State
): Plua_State
; cdecl;
133 function lua_atpanic(L
: Plua_State
; panicf
: lua_CFunction
): lua_CFunction
; cdecl;
136 ** basic stack manipulation
138 function lua_gettop(L
: Plua_State
): Integer; cdecl;
139 procedure lua_settop(L
: Plua_State
; idx
: Integer); cdecl;
140 procedure lua_pushvalue(L
: Plua_State
; Idx
: Integer); cdecl;
141 procedure lua_remove(L
: Plua_State
; idx
: Integer); cdecl;
142 procedure lua_insert(L
: Plua_State
; idx
: Integer); cdecl;
143 procedure lua_replace(L
: Plua_State
; idx
: Integer); cdecl;
144 function lua_checkstack(L
: Plua_State
; sz
: Integer): LongBool; cdecl;
146 procedure lua_xmove(from
, to_
: Plua_State
; n
: Integer); cdecl;
149 ** access functions (stack -> C)
151 function lua_isnumber(L
: Plua_State
; idx
: Integer): LongBool; cdecl;
152 function lua_isstring(L
: Plua_State
; idx
: Integer): LongBool; cdecl;
153 function lua_iscfunction(L
: Plua_State
; idx
: Integer): LongBool; cdecl;
154 function lua_isuserdata(L
: Plua_State
; idx
: Integer): LongBool; cdecl;
155 function lua_type(L
: Plua_State
; idx
: Integer): Integer; cdecl;
156 function lua_typename(L
: Plua_State
; tp
: Integer): PChar; cdecl;
158 function lua_equal(L
: Plua_State
; idx1
, idx2
: Integer): LongBool; cdecl;
159 function lua_rawequal(L
: Plua_State
; idx1
, idx2
: Integer): LongBool; cdecl;
160 function lua_lessthan(L
: Plua_State
; idx1
, idx2
: Integer): LongBool; cdecl;
162 function lua_tonumber(L
: Plua_State
; idx
: Integer): lua_Number
; cdecl;
163 function lua_tointeger(L
: Plua_State
; idx
: Integer): lua_Integer
; cdecl;
164 function lua_toboolean(L
: Plua_State
; idx
: Integer): LongBool; cdecl;
165 function lua_tolstring(L
: Plua_State
; idx
: Integer; len
: Psize_t
): PChar; cdecl;
166 function lua_objlen(L
: Plua_State
; idx
: Integer): size_t
; cdecl;
167 function lua_tocfunction(L
: Plua_State
; idx
: Integer): lua_CFunction
; cdecl;
168 function lua_touserdata(L
: Plua_State
; idx
: Integer): Pointer; cdecl;
169 function lua_tothread(L
: Plua_State
; idx
: Integer): Plua_State
; cdecl;
170 function lua_topointer(L
: Plua_State
; idx
: Integer): Pointer; cdecl;
173 ** push functions (C -> stack)
175 procedure lua_pushnil(L
: Plua_State
); cdecl;
176 procedure lua_pushnumber(L
: Plua_State
; n
: lua_Number
); cdecl;
177 procedure lua_pushinteger(L
: Plua_State
; n
: lua_Integer
); cdecl;
178 procedure lua_pushlstring(L
: Plua_State
; const s
: PChar; l_
: size_t
); cdecl;
179 procedure lua_pushstring(L
: Plua_State
; const s
: PChar); cdecl;
180 function lua_pushvfstring(L
: Plua_State
; const fmt
: PChar; argp
: Pointer): PChar; cdecl;
181 function lua_pushfstring(L
: Plua_State
; const fmt
: PChar): PChar; cdecl; varargs
;
182 procedure lua_pushcclosure(L
: Plua_State
; fn
: lua_CFunction
; n
: Integer); cdecl;
183 procedure lua_pushboolean(L
: Plua_State
; b
: LongBool); cdecl;
184 procedure lua_pushlightuserdata(L
: Plua_State
; p
: Pointer); cdecl;
185 procedure lua_pushthread(L
: Plua_State
); cdecl;
188 ** get functions (Lua -> stack)
190 procedure lua_gettable(L
: Plua_State
; idx
: Integer); cdecl;
191 procedure lua_getfield(L
: Plua_state
; idx
: Integer; k
: PChar); cdecl;
192 procedure lua_rawget(L
: Plua_State
; idx
: Integer); cdecl;
193 procedure lua_rawgeti(L
: Plua_State
; idx
, n
: Integer); cdecl;
194 procedure lua_createtable(L
: Plua_State
; narr
, nrec
: Integer); cdecl;
195 function lua_newuserdata(L
: Plua_State
; sz
: size_t
): Pointer; cdecl;
196 function lua_getmetatable(L
: Plua_State
; objindex
: Integer): Integer; cdecl;
197 procedure lua_getfenv(L
: Plua_State
; idx
: Integer); cdecl;
200 ** set functions (stack -> Lua)
202 procedure lua_settable(L
: Plua_State
; idx
: Integer); cdecl;
203 procedure lua_setfield(L
: Plua_State
; idx
: Integer; k
: PChar); cdecl;
204 procedure lua_rawset(L
: Plua_State
; idx
: Integer); cdecl;
205 procedure lua_rawseti(L
: Plua_State
; idx
, n
: Integer); cdecl;
206 function lua_setmetatable(L
: Plua_State
; objindex
: Integer): Integer; cdecl;
207 function lua_setfenv(L
: Plua_State
; idx
: Integer): Integer; cdecl;
210 ** `load' and `call' functions (load and run Lua code)
212 procedure lua_call(L
: Plua_State
; nargs
, nresults
: Integer); cdecl;
213 function lua_pcall(L
: Plua_State
; nargs
, nresults
, errf
: Integer): Integer; cdecl;
214 function lua_cpcall(L
: Plua_State
; func
: lua_CFunction
; ud
: Pointer): Integer; cdecl;
215 function lua_load(L
: Plua_State
; reader
: lua_Reader
; dt
: Pointer; const chunkname
: PChar): Integer; cdecl;
217 function lua_dump(L
: Plua_State
; writer
: lua_Writer
; data
: Pointer): Integer; cdecl;
220 ** coroutine functions
222 function lua_yield(L
: Plua_State
; nresults
: Integer): Integer; cdecl;
223 function lua_resume(L
: Plua_State
; narg
: Integer): Integer; cdecl;
224 function lua_status(L
: Plua_State
): Integer; cdecl;
227 ** Garbage-collection functions and options
237 LUA_GCSETSTEPMUL
= 7;
239 function lua_gc(L
: Plua_State
; what
, data
: Integer): Integer; cdecl;
242 ** miscellaneous functions
244 function lua_error(L
: Plua_State
): Integer; cdecl;
246 function lua_next(L
: Plua_State
; idx
: Integer): Integer; cdecl;
248 procedure lua_concat(L
: Plua_State
; n
: Integer); cdecl;
250 function lua_getallocf(L
: Plua_State
; ud
: PPointer): lua_Alloc
; cdecl;
251 procedure lua_setallocf(L
: Plua_State
; f
: lua_Alloc
; ud
: Pointer); cdecl;
254 ** ===============================================================
255 ** some useful macros
256 ** ===============================================================
259 procedure lua_pop(L
: Plua_State
; n
: Integer);
261 procedure lua_newtable(L
: Plua_state
);
263 procedure lua_register(L
: Plua_State
; const n
: PChar; f
: lua_CFunction
);
264 procedure lua_pushcfunction(L
: Plua_State
; f
: lua_CFunction
);
266 function lua_strlen(L
: Plua_state
; i
: Integer): size_t
;
268 function lua_isfunction(L
: Plua_State
; n
: Integer): Boolean;
269 function lua_istable(L
: Plua_State
; n
: Integer): Boolean;
270 function lua_islightuserdata(L
: Plua_State
; n
: Integer): Boolean;
271 function lua_isnil(L
: Plua_State
; n
: Integer): Boolean;
272 function lua_isboolean(L
: Plua_State
; n
: Integer): Boolean;
273 function lua_isthread(L
: Plua_State
; n
: Integer): Boolean;
274 function lua_isnone(L
: Plua_State
; n
: Integer): Boolean;
275 function lua_isnoneornil(L
: Plua_State
; n
: Integer): Boolean;
277 procedure lua_pushliteral(L
: Plua_State
; s
: PChar);
279 procedure lua_setglobal(L
: Plua_State
; const s
: PChar);
280 procedure lua_getglobal(L
: Plua_State
; const s
: PChar);
282 function lua_tostring(L
: Plua_State
; i
: Integer): PChar;
285 ** compatibility macros and functions
288 procedure lua_getregistry(L
: Plua_State
);
290 function lua_getgccount(L
: Plua_State
): Integer;
293 lua_Chunkreader
= lua_Reader
;
294 lua_Chunkwriter
= lua_Writer
;
297 ** {======================================================================
299 ** =======================================================================
310 LUA_MASKCALL
= 1 shl Ord(LUA_HOOKCALL
);
311 LUA_MASKRET
= 1 shl Ord(LUA_HOOKRET
);
312 LUA_MASKLINE
= 1 shl Ord(LUA_HOOKLINE
);
313 LUA_MASKCOUNT
= 1 shl Ord(LUA_HOOKCOUNT
);
319 lua_Debug
= record (* activation record *)
321 name
: PChar; (* (n) *)
322 namewhat
: PChar; (* (n) `global', `local', `field', `method' *)
323 what
: PChar; (* (S) `Lua', `C', `main', `tail'*)
324 source
: PChar; (* (S) *)
325 currentline
: Integer; (* (l) *)
326 nups
: Integer; (* (u) number of upvalues *)
327 linedefined
: Integer; (* (S) *)
328 lastlinedefined
: Integer; (* (S) *)
329 short_src
: array[0..LUA_IDSIZE
- 1] of Char; (* (S) *)
331 i_ci
: Integer; (* active function *)
333 Plua_Debug
= ^lua_Debug
;
335 lua_Hook
= procedure(L
: Plua_State
; ar
: Plua_Debug
); cdecl;
337 function lua_getstack(L
: Plua_State
; level
: Integer; ar
: Plua_Debug
): Integer; cdecl;
338 function lua_getinfo(L
: Plua_State
; const what
: PChar; ar
: Plua_Debug
): Integer; cdecl;
339 function lua_getlocal(L
: Plua_State
; const ar
: Plua_Debug
; n
: Integer): PChar; cdecl;
340 function lua_setlocal(L
: Plua_State
; const ar
: Plua_Debug
; n
: Integer): PChar; cdecl;
341 function lua_getupvalue(L
: Plua_State
; funcindex
: Integer; n
: Integer): PChar; cdecl;
342 function lua_setupvalue(L
: Plua_State
; funcindex
: Integer; n
: Integer): PChar; cdecl;
344 function lua_sethook(L
: Plua_State
; func
: lua_Hook
; mask
: Integer; count
: Integer): Integer; cdecl;
345 //function lua_gethook(L: Plua_State): lua_Hook; cdecl;
346 function lua_gethookmask(L
: Plua_State
): Integer; cdecl;
347 function lua_gethookcount(L
: Plua_State
): Integer; cdecl;
351 function lua_upvalueindex(I
: Integer): Integer;
353 Result
:= LUA_GLOBALSINDEX
- i
;
356 function lua_newstate(f
: lua_Alloc
; ud
: Pointer): Plua_State
; cdecl; external LUA_NAME
;
357 procedure lua_close(L
: Plua_State
); cdecl; external LUA_NAME
;
358 function lua_newthread(L
: Plua_State
): Plua_State
; cdecl; external LUA_NAME
;
360 function lua_atpanic(L
: Plua_State
; panicf
: lua_CFunction
): lua_CFunction
; cdecl; external LUA_NAME
;
362 function lua_gettop(L
: Plua_State
): Integer; cdecl; external LUA_NAME
;
363 procedure lua_settop(L
: Plua_State
; idx
: Integer); cdecl; external LUA_NAME
;
364 procedure lua_pushvalue(L
: Plua_State
; Idx
: Integer); cdecl; external LUA_NAME
;
365 procedure lua_remove(L
: Plua_State
; idx
: Integer); cdecl; external LUA_NAME
;
366 procedure lua_insert(L
: Plua_State
; idx
: Integer); cdecl; external LUA_NAME
;
367 procedure lua_replace(L
: Plua_State
; idx
: Integer); cdecl; external LUA_NAME
;
368 function lua_checkstack(L
: Plua_State
; sz
: Integer): LongBool; cdecl; external LUA_NAME
;
369 procedure lua_xmove(from
, to_
: Plua_State
; n
: Integer); cdecl; external LUA_NAME
;
371 function lua_isnumber(L
: Plua_State
; idx
: Integer): LongBool; cdecl; external LUA_NAME
;
372 function lua_isstring(L
: Plua_State
; idx
: Integer): LongBool; cdecl; external LUA_NAME
;
373 function lua_iscfunction(L
: Plua_State
; idx
: Integer): LongBool; cdecl; external LUA_NAME
;
374 function lua_isuserdata(L
: Plua_State
; idx
: Integer): LongBool; cdecl; external LUA_NAME
;
375 function lua_type(L
: Plua_State
; idx
: Integer): Integer; cdecl; external LUA_NAME
;
376 function lua_typename(L
: Plua_State
; tp
: Integer): PChar; cdecl; external LUA_NAME
;
378 function lua_equal(L
: Plua_State
; idx1
, idx2
: Integer): LongBool; cdecl; external LUA_NAME
;
379 function lua_rawequal(L
: Plua_State
; idx1
, idx2
: Integer): LongBool; cdecl; external LUA_NAME
;
380 function lua_lessthan(L
: Plua_State
; idx1
, idx2
: Integer): LongBool; cdecl; external LUA_NAME
;
382 function lua_tonumber(L
: Plua_State
; idx
: Integer): lua_Number
; cdecl; external LUA_NAME
;
383 function lua_tointeger(L
: Plua_State
; idx
: Integer): lua_Integer
; cdecl; external LUA_NAME
;
384 function lua_toboolean(L
: Plua_State
; idx
: Integer): LongBool; cdecl; external LUA_NAME
;
385 function lua_tolstring(L
: Plua_State
; idx
: Integer; len
: Psize_t
): PChar; cdecl; external LUA_NAME
;
386 function lua_objlen(L
: Plua_State
; idx
: Integer): size_t
; cdecl; external LUA_NAME
;
387 function lua_tocfunction(L
: Plua_State
; idx
: Integer): lua_CFunction
; cdecl; external LUA_NAME
;
388 function lua_touserdata(L
: Plua_State
; idx
: Integer): Pointer; cdecl; external LUA_NAME
;
389 function lua_tothread(L
: Plua_State
; idx
: Integer): Plua_State
; cdecl; external LUA_NAME
;
390 function lua_topointer(L
: Plua_State
; idx
: Integer): Pointer; cdecl; external LUA_NAME
;
392 procedure lua_pushnil(L
: Plua_State
); cdecl; external LUA_NAME
;
393 procedure lua_pushnumber(L
: Plua_State
; n
: lua_Number
); cdecl; external LUA_NAME
;
394 procedure lua_pushinteger(L
: Plua_State
; n
: lua_Integer
); cdecl; external LUA_NAME
;
395 procedure lua_pushlstring(L
: Plua_State
; const s
: PChar; l_
: size_t
); cdecl; external LUA_NAME
;
396 procedure lua_pushstring(L
: Plua_State
; const s
: PChar); cdecl; external LUA_NAME
;
397 function lua_pushvfstring(L
: Plua_State
; const fmt
: PChar; argp
: Pointer): PChar; cdecl; external LUA_NAME
;
398 function lua_pushfstring(L
: Plua_State
; const fmt
: PChar): PChar; cdecl; varargs
; external LUA_NAME
;
399 procedure lua_pushcclosure(L
: Plua_State
; fn
: lua_CFunction
; n
: Integer); cdecl; external LUA_NAME
;
400 procedure lua_pushboolean(L
: Plua_State
; b
: LongBool); cdecl; external LUA_NAME
;
401 procedure lua_pushlightuserdata(L
: Plua_State
; p
: Pointer); cdecl; external LUA_NAME
;
402 procedure lua_pushthread(L
: Plua_State
); cdecl; external LUA_NAME
;
404 procedure lua_gettable(L
: Plua_State
; idx
: Integer); cdecl; external LUA_NAME
;
405 procedure lua_getfield(L
: Plua_state
; idx
: Integer; k
: PChar); cdecl; external LUA_NAME
;
406 procedure lua_rawget(L
: Plua_State
; idx
: Integer); cdecl; external LUA_NAME
;
407 procedure lua_rawgeti(L
: Plua_State
; idx
, n
: Integer); cdecl; external LUA_NAME
;
408 procedure lua_createtable(L
: Plua_State
; narr
, nrec
: Integer); cdecl; external LUA_NAME
;
409 function lua_newuserdata(L
: Plua_State
; sz
: size_t
): Pointer; cdecl; external LUA_NAME
;
410 function lua_getmetatable(L
: Plua_State
; objindex
: Integer): Integer; cdecl; external LUA_NAME
;
411 procedure lua_getfenv(L
: Plua_State
; idx
: Integer); cdecl; external LUA_NAME
;
413 procedure lua_settable(L
: Plua_State
; idx
: Integer); cdecl; external LUA_NAME
;
414 procedure lua_setfield(L
: Plua_State
; idx
: Integer; k
: PChar); cdecl; external LUA_NAME
;
415 procedure lua_rawset(L
: Plua_State
; idx
: Integer); cdecl; external LUA_NAME
;
416 procedure lua_rawseti(L
: Plua_State
; idx
, n
: Integer); cdecl; external LUA_NAME
;
417 function lua_setmetatable(L
: Plua_State
; objindex
: Integer): Integer; cdecl; external LUA_NAME
;
418 function lua_setfenv(L
: Plua_State
; idx
: Integer): Integer; cdecl; external LUA_NAME
;
420 procedure lua_call(L
: Plua_State
; nargs
, nresults
: Integer); cdecl; external LUA_NAME
;
421 function lua_pcall(L
: Plua_State
; nargs
, nresults
, errf
: Integer): Integer; cdecl; external LUA_NAME
;
422 function lua_cpcall(L
: Plua_State
; func
: lua_CFunction
; ud
: Pointer): Integer; cdecl; external LUA_NAME
;
423 function lua_load(L
: Plua_State
; reader
: lua_Reader
; dt
: Pointer; const chunkname
: PChar): Integer; cdecl; external LUA_NAME
;
425 function lua_dump(L
: Plua_State
; writer
: lua_Writer
; data
: Pointer): Integer; cdecl; external LUA_NAME
;
427 function lua_yield(L
: Plua_State
; nresults
: Integer): Integer; cdecl; external LUA_NAME
;
428 function lua_resume(L
: Plua_State
; narg
: Integer): Integer; cdecl; external LUA_NAME
;
429 function lua_status(L
: Plua_State
): Integer; cdecl; external LUA_NAME
;
431 function lua_gc(L
: Plua_State
; what
, data
: Integer): Integer; cdecl; external LUA_NAME
;
433 function lua_error(L
: Plua_State
): Integer; cdecl; external LUA_NAME
;
434 function lua_next(L
: Plua_State
; idx
: Integer): Integer; cdecl; external LUA_NAME
;
435 procedure lua_concat(L
: Plua_State
; n
: Integer); cdecl; external LUA_NAME
;
437 function lua_getallocf(L
: Plua_State
; ud
: PPointer): lua_Alloc
; cdecl; external LUA_NAME
;
438 procedure lua_setallocf(L
: Plua_State
; f
: lua_Alloc
; ud
: Pointer); cdecl; external LUA_NAME
;
440 procedure lua_pop(L
: Plua_State
; n
: Integer);
442 lua_settop(L
, -n
- 1);
445 procedure lua_newtable(L
: Plua_State
);
447 lua_createtable(L
, 0, 0);
450 procedure lua_register(L
: Plua_State
; const n
: PChar; f
: lua_CFunction
);
452 lua_pushcfunction(L
, f
);
456 procedure lua_pushcfunction(L
: Plua_State
; f
: lua_CFunction
);
458 lua_pushcclosure(L
, f
, 0);
461 function lua_strlen(L
: Plua_State
; i
: Integer): size_t
;
463 Result
:= lua_objlen(L
, i
);
466 function lua_isfunction(L
: Plua_State
; n
: Integer): Boolean;
468 Result
:= lua_type(L
, n
) = LUA_TFUNCTION
;
471 function lua_istable(L
: Plua_State
; n
: Integer): Boolean;
473 Result
:= lua_type(L
, n
) = LUA_TTABLE
;
476 function lua_islightuserdata(L
: Plua_State
; n
: Integer): Boolean;
478 Result
:= lua_type(L
, n
) = LUA_TLIGHTUSERDATA
;
481 function lua_isnil(L
: Plua_State
; n
: Integer): Boolean;
483 Result
:= lua_type(L
, n
) = LUA_TNIL
;
486 function lua_isboolean(L
: Plua_State
; n
: Integer): Boolean;
488 Result
:= lua_type(L
, n
) = LUA_TBOOLEAN
;
491 function lua_isthread(L
: Plua_State
; n
: Integer): Boolean;
493 Result
:= lua_type(L
, n
) = LUA_TTHREAD
;
496 function lua_isnone(L
: Plua_State
; n
: Integer): Boolean;
498 Result
:= lua_type(L
, n
) = LUA_TNONE
;
501 function lua_isnoneornil(L
: Plua_State
; n
: Integer): Boolean;
503 Result
:= lua_type(L
, n
) <= 0;
506 procedure lua_pushliteral(L
: Plua_State
; s
: PChar);
508 lua_pushlstring(L
, s
, Length(s
));
511 procedure lua_setglobal(L
: Plua_State
; const s
: PChar);
513 lua_setfield(L
, LUA_GLOBALSINDEX
, s
);
516 procedure lua_getglobal(L
: Plua_State
; const s
: PChar);
518 lua_getfield(L
, LUA_GLOBALSINDEX
, s
);
521 function lua_tostring(L
: Plua_State
; i
: Integer): PChar;
523 Result
:= lua_tolstring(L
, i
, nil);
527 procedure lua_getregistry(L
: Plua_State
);
529 lua_pushvalue(L
, LUA_REGISTRYINDEX
);
532 function lua_getgccount(L
: Plua_State
): Integer;
534 Result
:= lua_gc(L
, LUA_GCCOUNT
, 0);
538 ** {======================================================================
540 ** =======================================================================
543 function lua_getstack(L
: Plua_State
; level
: Integer; ar
: Plua_Debug
): Integer; cdecl; external LUA_NAME
;
544 function lua_getinfo(L
: Plua_State
; const what
: PChar; ar
: Plua_Debug
): Integer; cdecl; external LUA_NAME
;
545 function lua_getlocal(L
: Plua_State
; const ar
: Plua_Debug
; n
: Integer): PChar; cdecl; external LUA_NAME
;
546 function lua_setlocal(L
: Plua_State
; const ar
: Plua_Debug
; n
: Integer): PChar; cdecl; external LUA_NAME
;
547 function lua_getupvalue(L
: Plua_State
; funcindex
: Integer; n
: Integer): PChar; cdecl; external LUA_NAME
;
548 function lua_setupvalue(L
: Plua_State
; funcindex
: Integer; n
: Integer): PChar; cdecl; external LUA_NAME
;
549 function lua_sethook(L
: Plua_State
; func
: lua_Hook
; mask
: Integer; count
: Integer): Integer; cdecl; external LUA_NAME
;
550 //function lua_gethook(L: Plua_State): lua_Hook; cdecl; external LUA_NAME;
551 function lua_gethookmask(L
: Plua_State
): Integer; cdecl; external LUA_NAME
;
552 function lua_gethookcount(L
: Plua_State
): Integer; cdecl; external LUA_NAME
;
553 (******************************************************************************
554 * Copyright (C) 1994-2003 Tecgraf, PUC-Rio. All rights reserved.
556 * Permission is hereby granted, free of charge, to any person obtaining
557 * a copy of this software and associated documentation files (the
558 * "Software"), to deal in the Software without restriction, including
559 * without limitation the rights to use, copy, modify, merge, publish,
560 * distribute, sublicense, and/or sell copies of the Software, and to
561 * permit persons to whom the Software is furnished to do so, subject to
562 * the following conditions:
564 * The above copyright notice and this permission notice shall be
565 * included in all copies or substantial portions of the Software.
567 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
568 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
569 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
570 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
571 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
572 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
573 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
574 ******************************************************************************)