equal
deleted
inserted
replaced
1 {$HINTS OFF} |
1 {$HINTS OFF} |
|
2 {$INCLUDE "options.inc"} |
2 |
3 |
3 unit LuaPas; |
4 unit LuaPas; |
4 |
5 |
5 (* |
6 (* |
6 * A complete Pascal wrapper for Lua 5.1 DLL module. |
7 * A complete Pascal wrapper for Lua 5.1 DLL module. |
21 PPointer = ^Pointer; |
22 PPointer = ^Pointer; |
22 |
23 |
23 lua_State = record end; |
24 lua_State = record end; |
24 Plua_State = ^lua_State; |
25 Plua_State = ^lua_State; |
25 |
26 |
26 const |
27 {$DEFINE LuaLibName:= cLuaLibrary} |
27 LuaLibName = cLuaLibrary; |
|
28 |
28 |
29 |
29 |
30 (*****************************************************************************) |
30 (*****************************************************************************) |
31 (* luaconfig.h *) |
31 (* luaconfig.h *) |
32 (*****************************************************************************) |
32 (*****************************************************************************) |
79 @@ lua_saveline defines how to "save" a read line in a "history". |
79 @@ lua_saveline defines how to "save" a read line in a "history". |
80 @@ lua_freeline defines how to free a line read by lua_readline. |
80 @@ lua_freeline defines how to free a line read by lua_readline. |
81 ** CHANGE them if you want to improve this functionality (e.g., by using |
81 ** CHANGE them if you want to improve this functionality (e.g., by using |
82 ** GNU readline and history facilities). |
82 ** GNU readline and history facilities). |
83 *) |
83 *) |
84 function lua_readline(L : Plua_State; |
84 {function lua_readline(L : Plua_State; |
85 var b : PChar; p : PChar): Boolean; |
85 var b : PChar; p : PChar): Boolean;} |
86 |
86 |
87 procedure lua_saveline(L : Plua_State; idx : LongInt); |
87 procedure lua_saveline(L : Plua_State; idx : LongInt); |
88 |
88 |
89 procedure lua_freeline(L : Plua_State; b : PChar); |
89 procedure lua_freeline(L : Plua_State; b : PChar); |
90 |
90 |
117 LUA_VERSION_NUM = 501; |
117 LUA_VERSION_NUM = 501; |
118 LUA_COPYRIGHT = 'Copyright (C) 1994-2006 Tecgraf, PUC-Rio'; |
118 LUA_COPYRIGHT = 'Copyright (C) 1994-2006 Tecgraf, PUC-Rio'; |
119 LUA_AUTHORS = 'R. Ierusalimschy, L. H. de Figueiredo & W. Celes'; |
119 LUA_AUTHORS = 'R. Ierusalimschy, L. H. de Figueiredo & W. Celes'; |
120 |
120 |
121 (* mark for precompiled code (`<esc>Lua') *) |
121 (* mark for precompiled code (`<esc>Lua') *) |
122 LUA_SIGNATURE = #27 + 'Lua'; |
122 //LUA_SIGNATURE = #27'Lua'; |
123 |
123 |
124 (* option for multiple returns in `lua_pcall' and `lua_call' *) |
124 (* option for multiple returns in `lua_pcall' and `lua_call' *) |
125 LUA_MULTRET = -1; |
125 LUA_MULTRET = -1; |
126 |
126 |
127 (* |
127 (* |
797 SysUtils; |
797 SysUtils; |
798 |
798 |
799 (*****************************************************************************) |
799 (*****************************************************************************) |
800 (* luaconfig.h *) |
800 (* luaconfig.h *) |
801 (*****************************************************************************) |
801 (*****************************************************************************) |
802 |
802 { |
803 function lua_readline(L : Plua_State; |
803 function lua_readline(L : Plua_State; |
804 var |
804 var |
805 b : PChar; p : PChar): Boolean; |
805 b : PChar; p : PChar): Boolean; |
806 var |
806 var |
807 s : AnsiString; |
807 s : AnsiString; |
809 Write(p); // show prompt |
809 Write(p); // show prompt |
810 ReadLn(s); // get line |
810 ReadLn(s); // get line |
811 b := PChar(s); // and return it |
811 b := PChar(s); // and return it |
812 lua_readline := (b[0] <> #4); // test for ctrl-D |
812 lua_readline := (b[0] <> #4); // test for ctrl-D |
813 end; |
813 end; |
814 |
814 } |
815 procedure lua_saveline(L : Plua_State; idx : LongInt); |
815 procedure lua_saveline(L : Plua_State; idx : LongInt); |
816 begin |
816 begin |
817 end; |
817 end; |
818 |
818 |
819 procedure lua_freeline(L : Plua_State; b : PChar); |
819 procedure lua_freeline(L : Plua_State; b : PChar); |
1039 begin |
1039 begin |
1040 if lock then |
1040 if lock then |
1041 lua_ref := luaL_ref(L, LUA_REGISTRYINDEX) |
1041 lua_ref := luaL_ref(L, LUA_REGISTRYINDEX) |
1042 else |
1042 else |
1043 begin |
1043 begin |
1044 lua_pushstring(L, 'unlocked references are obsolete'); |
1044 lua_pushstring(L, _P'unlocked references are obsolete'); |
1045 lua_error(L); |
1045 lua_error(L); |
1046 lua_ref := 0; |
1046 lua_ref := 0; |
1047 end; |
1047 end; |
1048 end; |
1048 end; |
1049 |
1049 |