hedgewars/uScript.pas
branchhedgeroid
changeset 6224 42b256eca362
parent 6023 a28be05b20bc
parent 6131 4e8816cf9459
child 6328 d14adf1c7721
--- a/hedgewars/uScript.pas	Fri Oct 28 17:41:39 2011 +0200
+++ b/hedgewars/uScript.pas	Fri Oct 28 18:26:17 2011 +0200
@@ -960,8 +960,12 @@
             end
         else lua_pushinteger(L, 0)
         end
-    else LuaError('Lua: Wrong number of parameters passed to GetAmmoCount!');
-    lc_getammocount:= 0
+    else 
+        begin
+        LuaError('Lua: Wrong number of parameters passed to GetAmmoCount!');
+        lua_pushnil(L)
+        end;
+    lc_getammocount:= 1
 end;
 
 function lc_sethealth(L : Plua_State) : LongInt; Cdecl;
@@ -1594,6 +1598,7 @@
     exit;
 
 // push game variables so they may be modified by the script
+ScriptSetInteger('BorderColor', cExplosionBorderColor);
 ScriptSetInteger('GameFlags', GameFlags);
 ScriptSetString('Seed', cSeed);
 ScriptSetInteger('TemplateFilter', cTemplateFilter);
@@ -1672,6 +1677,8 @@
 begin
 s:= UserPathz[ptData] + '/' + name;
 if not FileExists(s) then s:= Pathz[ptData] + '/' + name;
+if not FileExists(s) then exit;
+
 ret:= luaL_loadfile(luaState, Str2PChar(s));
 if ret <> 0 then
     begin