LuaDelphi2010-v1.3
所属分类:编译器/解释器
开发工具:Delphi
文件大小:171KB
下载次数:6
上传日期:2018-08-09 11:29:48
上 传 者:
云之遥的影子
说明: Lua 5.1 for Delphi 2010 脚本解析器。
附带lib和示例,可以轻松建立自己的lua脚本解析器。
(This is a Lua Wrapper for Delphi 2009 and 2010. It is based on
Lua-Pascal v0.2 by Marco Antonio Abreu
TLua automatically creates OOP callback functions for Delphi and Lua:)
文件列表:
Dll (0, 2009-10-01)
Dll\lua5.1.dll (167936, 2008-08-28)
Dll\LuaDelphi.dpr (528, 2009-09-30)
Dll\run.bat (12, 2009-10-01)
Dll\test.lua (319, 2009-09-30)
Example (0, 2009-10-01)
Example\helloworld.lua (197, 2009-09-30)
Example\lua5.1.dll (167936, 2009-09-29)
Example\LuaTest.dpr (1505, 2009-09-30)
Example\MyLua.pas (1929, 2009-09-30)
Example\simple.lua (32, 2009-09-30)
Example\SomeClass.pas (349, 2009-09-30)
Lib (0, 2009-10-01)
Lib\Lua.pas (7493, 2009-09-30)
Lib\LuaLib.pas (40862, 2009-09-29)
=================================
Lua 5.1 for Delphi 2010 v1.3
=================================
(c) 2009 Dennis D. Spreen
http://www.spreendigital.de/blog/
=================================
History
1.3 DS Improved Callback, now uses pointer instead of object index
Modified RegisterFunctions to allow methods from other class
to be registered, moved object table into TLua class
1.2 DS Added example on how to extend lua with a delphi dll
1.1 DS Improved global object table, optimized delphi
function calls
1.0 DS Initial Release
This is a Lua Wrapper for Delphi 2009 and 2010. It is based on
Lua-Pascal v0.2 by Marco Antonio Abreu (www.marcoabreu.eti.br):
- converted PChar to PAnsiChar
- converted Char to AnsiChar
- added function LuaLibLoaded: Boolean;
- added a new base class (TLua) with OOP call back functions
TLua automatically creates OOP callback functions for Delphi <-> Lua:
uses
Lua, LuaLib;
type
TMyLua = class(TLua)
published
function HelloWorld(LuaState: TLuaState): Integer;
end;
function TMyLua.HelloWorld(LuaState: TLuaState): Integer;
var
ArgCount: Integer;
I: integer;
begin
ArgCount := Lua_GetTop(LuaState);
writeln('Delphi: Hello World');
writeln('Arguments: ', ArgCount);
for I := 1 to ArgCount do
writeln('Arg1', I, ': ', Lua_ToInteger(LuaState, I));
// Clear stack
Lua_Pop(LuaState, Lua_GetTop(LuaState));
// Push return values
Lua_PushInteger(LuaState, 101);
Lua_PushInteger(LuaState, 102);
Result := 2;
end;
var
MyLua: TLua;
begin
MyLua := TMyLua.Create;
MyLua.DoFile('Helloworld.lua');
MyLua.Free;
end;
helloworld.lua
print("LuaDelphi Test");
p1,p2 = HelloWorld(1,2,3)
print "Results:";
print (p1);
print (p2);
**************************************************************************
Copyright 2009 Dennis D. Spreen (http://www.spreendigital.de/blog/)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
**************************************************************************
近期下载者:
相关文件:
收藏者: