hedgewars/uScript.pas
changeset 3038 4e48c276a468
parent 3034 b576460ba8ad
child 3043 3acdb4dac6eb
equal deleted inserted replaced
3037:ab6e949eb5cb 3038:4e48c276a468
    32 function ScriptCall(fname : shortstring; par1, par2: LongInt) : LongInt;
    32 function ScriptCall(fname : shortstring; par1, par2: LongInt) : LongInt;
    33 function ScriptCall(fname : shortstring; par1, par2, par3: LongInt) : LongInt;
    33 function ScriptCall(fname : shortstring; par1, par2, par3: LongInt) : LongInt;
    34 function ScriptCall(fname : shortstring; par1, par2, par3, par4 : LongInt) : LongInt;
    34 function ScriptCall(fname : shortstring; par1, par2, par3, par4 : LongInt) : LongInt;
    35 function ScriptExists(fname : shortstring) : boolean;
    35 function ScriptExists(fname : shortstring) : boolean;
    36 
    36 
    37 procedure init_uScript;
    37 procedure initModule;
    38 procedure free_uScript;
    38 procedure freeModule;
    39 
    39 
    40 implementation
    40 implementation
    41 {$IFNDEF IPHONEOS}
    41 {$IFNDEF IPHONEOS}
    42 uses LuaPas in 'LuaPas.pas',
    42 uses LuaPas in 'LuaPas.pas',
    43     uConsole,
    43     uConsole,
   670 
   670 
   671 procedure ScriptPrepareAmmoStore;
   671 procedure ScriptPrepareAmmoStore;
   672 var i: ShortInt;
   672 var i: ShortInt;
   673 begin
   673 begin
   674 // reset ammostore (quite unclean, but works?)
   674 // reset ammostore (quite unclean, but works?)
   675 free_uAmmos;
   675 uAmmos.freeModule;
   676 init_uAmmos;
   676 uAmmos.initModule;
   677 ScriptAmmoStore:= '';
   677 ScriptAmmoStore:= '';
   678 for i:=1 to ord(High(TAmmoType)) do
   678 for i:=1 to ord(High(TAmmoType)) do
   679     ScriptAmmoStore:= ScriptAmmoStore + '0000';
   679     ScriptAmmoStore:= ScriptAmmoStore + '0000';
   680 end;
   680 end;
   681 
   681 
   710 begin
   710 begin
   711 str:= GetEnumName(TypeInfo(TAmmoType), ord(en))
   711 str:= GetEnumName(TypeInfo(TAmmoType), ord(en))
   712 end;
   712 end;
   713 ///////////////////
   713 ///////////////////
   714 
   714 
   715 procedure init_uScript;
   715 procedure initModule;
   716 var at : TGearType;
   716 var at : TGearType;
   717     am : TAmmoType;
   717     am : TAmmoType;
   718     st : TSound;
   718     st : TSound;
   719 begin
   719 begin
   720 // initialize lua
   720 // initialize lua
   792 
   792 
   793 ScriptClearStack; // just to be sure stack is empty
   793 ScriptClearStack; // just to be sure stack is empty
   794 ScriptLoaded:= false;
   794 ScriptLoaded:= false;
   795 end;
   795 end;
   796 
   796 
   797 procedure free_uScript;
   797 procedure freeModule;
   798 begin
   798 begin
   799 lua_close(luaState);
   799 lua_close(luaState);
   800 end;
   800 end;
   801 
   801 
   802 {$ELSE}
   802 {$ELSE}
   843 function ScriptExists(fname : shortstring) : boolean;
   843 function ScriptExists(fname : shortstring) : boolean;
   844 begin
   844 begin
   845 ScriptExists:= false
   845 ScriptExists:= false
   846 end;
   846 end;
   847 
   847 
   848 procedure init_uScript;
   848 procedure initModule;
   849 begin
   849 begin
   850 end;
   850 end;
   851 
   851 
   852 procedure free_uScript;
   852 procedure freeModule;
   853 begin
   853 begin
   854 end;
   854 end;
   855 
   855 
   856 {$ENDIF}
   856 {$ENDIF}
   857 end.
   857 end.