aboutsummaryrefslogtreecommitdiffstats
path: root/Lua
diff options
context:
space:
mode:
authorwhiteshark0 <whiteshark0@b956fd51-792f-4845-bead-9b4dfca2ff2c>2009-05-04 12:44:57 +0000
committerwhiteshark0 <whiteshark0@b956fd51-792f-4845-bead-9b4dfca2ff2c>2009-05-04 12:44:57 +0000
commit0d68e084b810972ab0bc47d726b21bc886a235fe (patch)
tree27cc323009cf0e1fbbdadb5a64a88a4882f06d1f /Lua
parent632764b05d455fbb396ba65a799ed4f5e3cc36ae (diff)
downloadusdx-0d68e084b810972ab0bc47d726b21bc886a235fe.tar.gz
usdx-0d68e084b810972ab0bc47d726b21bc886a235fe.tar.xz
usdx-0d68e084b810972ab0bc47d726b21bc886a235fe.zip
prevent functions from plugins w/ unopened lua state from being called
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/branches/experimental@1711 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to '')
-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);