delphimvcframework/lib/luadelphibinding/samples/01/LuaEmbedded.dpr

35 lines
624 B
ObjectPascal
Raw Normal View History

2013-10-31 10:00:06 +01:00
program LuaEmbedded;
{$APPTYPE CONSOLE}
{$R *.res}
uses
System.SysUtils,
System.ioutils,
LuaBind,
LuaBind.Filters.Text;
var
lua: TLuaEngine;
filter: TLuaEmbeddedTextFilter;
begin
try
filter := TLuaEmbeddedTextFilter.Create;
try
filter.OutputFunction := 'io.write';
filter.TemplateCode := TFile.ReadAllText(ParamStr(1));
filter.Execute;
TFile.WriteAllText(ChangeFileExt(ParamStr(1), '.lua'), filter.LuaCode);
finally
filter.Free;
end;
except
on E: Exception do
Writeln(E.ClassName, ': ', E.Message);
end;
end.