DEADSOFTWARE

64ec473c4a319b62ad6e42ca45825cfc61b896f4
[d2df-sdl.git] / src / lib / lua / lualib.pas
1 (******************************************************************************
2 * *
3 * File: lualib.pas *
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: Standard Lua libraries *
8 * *
9 ******************************************************************************)
11 (*
12 ** $Id: lualib.h,v 1.28 2003/03/18 12:24:26 roberto Exp $
13 ** Lua standard libraries
14 ** See Copyright Notice in lua.h
15 *)
16 (*
17 ** Translated to pascal by Lavergne Thomas
18 ** Bug reports :
19 ** - thomas.lavergne@laposte.net
20 ** In french or in english
21 *)
23 {$IFDEF FPC}{$MODE OBJFPC}{$H+}{$ENDIF}
25 unit lualib;
27 interface
29 uses
30 Lua;
32 const
33 LUA_COLIBNAME = 'coroutine';
34 LUA_TABLIBNAME = 'table';
35 LUA_IOLIBNAME = 'io';
36 LUA_OSLIBNAME = 'os';
37 LUA_STRLIBNAME = 'string';
38 LUA_MATHLIBNAME = 'math';
39 LUA_DBLIBNAME = 'debug';
40 LUA_LOADLIBNAME = 'package';
42 function luaopen_base(L: Plua_State): Integer; cdecl;
43 function luaopen_table(L: Plua_State): Integer; cdecl;
44 function luaopen_io(L: Plua_State): Integer; cdecl;
45 function luaopen_os(L: Plua_State): Integer; cdecl;
46 function luaopen_string(L: Plua_State): Integer; cdecl;
47 function luaopen_math(L: Plua_State): Integer; cdecl;
48 function luaopen_debug(L: Plua_State): Integer; cdecl;
49 function luaopen_package(L: Plua_State): Integer; cdecl;
51 (* open all previous libraries *)
52 procedure luaL_openlibs(L: Plua_State); cdecl;
54 (* compatibility code *)
56 function lua_baselibopen(L: Plua_State): LongBool;
57 function lua_tablibopen(L: Plua_State): LongBool;
58 function lua_iolibopen(L: Plua_State): LongBool;
59 function lua_strlibopen(L: Plua_State): LongBool;
60 function lua_mathlibopen(L: Plua_State): LongBool;
61 function lua_dblibopen(L: Plua_State): LongBool;
63 implementation
65 function luaopen_base(L: Plua_State): Integer; cdecl; external LUA_LIB_NAME;
66 function luaopen_table(L: Plua_State): Integer; cdecl; external LUA_LIB_NAME;
67 function luaopen_io(L: Plua_State): Integer; cdecl; external LUA_LIB_NAME;
68 function luaopen_os(L: Plua_State): Integer; cdecl; external LUA_LIB_NAME;
69 function luaopen_string(L: Plua_State): Integer; cdecl; external LUA_LIB_NAME;
70 function luaopen_math(L: Plua_State): Integer; cdecl; external LUA_LIB_NAME;
71 function luaopen_debug(L: Plua_State): Integer; cdecl; external LUA_LIB_NAME;
72 function luaopen_package(L: Plua_State): Integer; cdecl; external LUA_LIB_NAME;
74 procedure luaL_openlibs(L: Plua_State); cdecl; external LUA_LIB_NAME;
76 function lua_baselibopen(L: Plua_State): LongBool;
77 begin
78 Result := LongBool(luaopen_base(L));
79 end;
81 function lua_tablibopen(L: Plua_State): LongBool;
82 begin
83 Result := LongBool(luaopen_table(L));
84 end;
86 function lua_iolibopen(L: Plua_State): LongBool;
87 begin
88 Result := LongBool(luaopen_io(L));
89 end;
91 function lua_strlibopen(L: Plua_State): LongBool;
92 begin
93 Result := LongBool(luaopen_string(L));
94 end;
96 function lua_mathlibopen(L: Plua_State): LongBool;
97 begin
98 Result := LongBool(luaopen_math(L));
99 end;
101 function lua_dblibopen(L: Plua_State): LongBool;
102 begin
103 Result := LongBool(luaopen_debug(L));
104 end;
106 end.