Fix ScriptExists() destroying lua stack (fixes Bug #146)
authorsheepluva
Sat, 10 Dec 2016 21:28:10 +0100
changeset 12107 0695302f3f5f
parent 12106 9bc19f722169
child 12108 c58bdc7b7939
Fix ScriptExists() destroying lua stack (fixes bug #146)
hedgewars/uScript.pas
--- a/hedgewars/uScript.pas	Sat Dec 10 19:09:25 2016 +0100
+++ b/hedgewars/uScript.pas	Sat Dec 10 21:28:10 2016 +0100
@@ -23,7 +23,7 @@
  * This unit defines, implements and registers functions and
  * variables/constants bindings for usage in Lua scripts.
  *
- * Please keep http://hedgewars.org/kb/LuaAPI up to date!
+ * Please keep https://hedgewars.org/kb/LuaAPI up to date!
  *
  * Note: If you add a new function, make sure to test if _all_ parameters
  *       work as intended! (Especially conversions errors can sneak in
@@ -3131,7 +3131,7 @@
     end;
 lua_getglobal(luaState, Str2PChar(fname));
 ScriptExists:= not lua_isnoneornil(luaState, -1);
-lua_pop(luaState, -1)
+lua_pop(luaState, 1)
 end;
 
 procedure ScriptPrepareAmmoStore;