hedgewars/uScript.pas
changeset 12321 d09eba2e1dd8
parent 12306 46e1e25fec5e
child 12337 657a8d63c99d
equal deleted inserted replaced
12320:0f98d45204d7 12321:d09eba2e1dd8
  2977 
  2977 
  2978 f:= pfsOpenRead(s);
  2978 f:= pfsOpenRead(s);
  2979 if f = nil then
  2979 if f = nil then
  2980     exit;
  2980     exit;
  2981 
  2981 
       
  2982 hedgewarsMountPackage(Str2PChar(copy(s, 1, length(s)-4)+'.hwp'));
       
  2983 
  2982 physfsReaderSetBuffer(@buf);
  2984 physfsReaderSetBuffer(@buf);
  2983 ret:= lua_load(luaState, @physfsReader, f, Str2PChar(s));
  2985 ret:= lua_load(luaState, @physfsReader, f, Str2PChar(s));
  2984 pfsClose(f);
  2986 pfsClose(f);
  2985 
  2987 
  2986 if ret <> 0 then
  2988 if ret <> 0 then
  2993     WriteLnToConsole('Lua: ' + name + ' loaded');
  2995     WriteLnToConsole('Lua: ' + name + ' loaded');
  2994     // call the script file
  2996     // call the script file
  2995     lua_pcall(luaState, 0, 0, 0);
  2997     lua_pcall(luaState, 0, 0, 0);
  2996     ScriptLoaded:= true
  2998     ScriptLoaded:= true
  2997     end;
  2999     end;
  2998 hedgewarsMountPackage(Str2PChar(copy(s, 1, length(s)-4)+'.hwp'));
       
  2999 end;
  3000 end;
  3000 
  3001 
  3001 procedure SetGlobals;
  3002 procedure SetGlobals;
  3002 begin
  3003 begin
  3003 ScriptSetInteger('TurnTimeLeft', TurnTimeLeft);
  3004 ScriptSetInteger('TurnTimeLeft', TurnTimeLeft);