|
|
|
@ -54,12 +54,15 @@ type
@@ -54,12 +54,15 @@ type
|
|
|
|
|
|
|
|
|
|
procedure RegisterObject; |
|
|
|
|
procedure RegisterObjectTable; |
|
|
|
|
|
|
|
|
|
procedure LoadFromFile; |
|
|
|
|
end; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
implementation |
|
|
|
|
uses |
|
|
|
|
System.Classes; |
|
|
|
|
System.Classes, |
|
|
|
|
System.IOUtils; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
type |
|
|
|
@ -500,6 +503,30 @@ begin
@@ -500,6 +503,30 @@ begin
|
|
|
|
|
end; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
procedure TTestWrapper.LoadFromFile; |
|
|
|
|
var |
|
|
|
|
fileName: string; |
|
|
|
|
script: TStringList; |
|
|
|
|
|
|
|
|
|
begin |
|
|
|
|
fileName := TPath.GetTempFileName; |
|
|
|
|
try |
|
|
|
|
script := TStringList.Create; |
|
|
|
|
try |
|
|
|
|
script.Add('print("Hello world!")'); |
|
|
|
|
script.SaveToFile(fileName); |
|
|
|
|
finally |
|
|
|
|
FreeAndNil(script); |
|
|
|
|
end; |
|
|
|
|
|
|
|
|
|
Lua.LoadFromFile(fileName); |
|
|
|
|
CheckEquals('Hello world!', Printed.ToString); |
|
|
|
|
finally |
|
|
|
|
TFile.Delete(fileName); |
|
|
|
|
end; |
|
|
|
|
end; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{ TTestObject } |
|
|
|
|
constructor TTestObject.Create(AOutput: TStringBuilder); |
|
|
|
|
begin |
|
|
|
|