aboutsummaryrefslogtreecommitdiffstats
path: root/Lua/src
diff options
context:
space:
mode:
Diffstat (limited to 'Lua/src')
-rw-r--r--Lua/src/lua/ULuaCore.pas4
1 files changed, 3 insertions, 1 deletions
diff --git a/Lua/src/lua/ULuaCore.pas b/Lua/src/lua/ULuaCore.pas
index 5c6f2463..c5b3a590 100644
--- a/Lua/src/lua/ULuaCore.pas
+++ b/Lua/src/lua/ULuaCore.pas
@@ -644,6 +644,8 @@ begin
Self.ErrorCount := 0;
Self.sName := 'not registred';
Self.sStatus := psNone;
+
+ State := nil; //< to prevent calls to unopened state
end;
destructor TLuaPlugin.Destroy;
@@ -753,7 +755,7 @@ end;
function TLuaPlugin.CallFunctionByName(Name: String; const nArgs: Integer; const nResults: Integer; const ReportErrors: Boolean): Boolean;
begin
Result := false;
- if not bPaused then
+ if (not bPaused) and (State <> nil) then
begin
// we need at least one stack slot free
lua_checkstack(State, 1);