mirror of
https://github.com/danieleteti/delphimvcframework.git
synced 2024-11-16 00:05:53 +01:00
40 lines
1004 B
ObjectPascal
40 lines
1004 B
ObjectPascal
program LuaConsole;
|
|
|
|
{$APPTYPE CONSOLE}
|
|
{$R *.res}
|
|
|
|
uses
|
|
LuaBind,
|
|
System.SysUtils,
|
|
LuaBind.Intf in '..\..\LuaBind.Intf.pas';
|
|
|
|
var
|
|
LuaEngine : TLuaEngine;
|
|
ScriptDir, PackagePathToAppend: string;
|
|
|
|
begin
|
|
try
|
|
LuaEngine := TLuaEngine.Create;
|
|
try
|
|
ScriptDir := IncludeTrailingPathDelimiter(ExtractFilePath(ParamStr(1)));
|
|
PackagePathToAppend := ScriptDir + '?.lua';
|
|
LuaEngine.ExecuteScript(
|
|
'package.path = package.path .. ";' + PackagePathToAppend.Replace('\', '\\') + '"' +
|
|
sLineBreak +
|
|
'__SCRIPTFILE__ = "' + ParamStr(1).Replace('\', '\\') + '"' + sLineBreak +
|
|
'__SCRIPTDIR__ = "' + ScriptDir.Replace('\', '\\') + '"' + sLineBreak
|
|
);
|
|
LuaEngine.LoadFromFile(ParamStr(1));
|
|
LuaEngine.Execute;
|
|
finally
|
|
LuaEngine.Free;
|
|
end;
|
|
except
|
|
on E: Exception do
|
|
Writeln(E.ClassName, ': ', E.Message);
|
|
end;
|
|
if DebugHook <> 0 then
|
|
readln;
|
|
|
|
end.
|