42 function ScriptCall(fname : shortstring; par1: LongInt) : LongInt; |
42 function ScriptCall(fname : shortstring; par1: LongInt) : LongInt; |
43 function ScriptCall(fname : shortstring; par1, par2: LongInt) : LongInt; |
43 function ScriptCall(fname : shortstring; par1, par2: LongInt) : LongInt; |
44 function ScriptCall(fname : shortstring; par1, par2, par3: LongInt) : LongInt; |
44 function ScriptCall(fname : shortstring; par1, par2, par3: LongInt) : LongInt; |
45 function ScriptCall(fname : shortstring; par1, par2, par3, par4 : LongInt) : LongInt; |
45 function ScriptCall(fname : shortstring; par1, par2, par3, par4 : LongInt) : LongInt; |
46 function ScriptExists(fname : shortstring) : boolean; |
46 function ScriptExists(fname : shortstring) : boolean; |
|
47 |
|
48 |
|
49 function ParseCommandOverride(key, value : shortstring) : shortstring; |
47 |
50 |
48 procedure initModule; |
51 procedure initModule; |
49 procedure freeModule; |
52 procedure freeModule; |
50 |
53 |
51 implementation |
54 implementation |
1720 begin |
1723 begin |
1721 LuaError('Lua: Error while calling ' + fname + ': ' + lua_tostring(luaState, -1)); |
1724 LuaError('Lua: Error while calling ' + fname + ': ' + lua_tostring(luaState, -1)); |
1722 lua_pop(luaState, 1) |
1725 lua_pop(luaState, 1) |
1723 end; |
1726 end; |
1724 GetGlobals; |
1727 GetGlobals; |
|
1728 end; |
|
1729 |
|
1730 function ParseCommandOverride(key, value : shortstring) : shortstring; |
|
1731 begin |
|
1732 ParseCommandOverride:= value; |
|
1733 if not ScriptExists('ParseCommandOverride') then exit; |
|
1734 lua_getglobal(luaState, Str2PChar('ParseCommandOverride')); |
|
1735 lua_pushstring(luaState, Str2PChar(key)); |
|
1736 lua_pushstring(luaState, Str2PChar(value)); |
|
1737 if lua_pcall(luaState, 2, 1, 0) <> 0 then |
|
1738 begin |
|
1739 LuaError('Lua: Error while calling ParseCommandOverride: ' + lua_tostring(luaState, -1)); |
|
1740 lua_pop(luaState, 1) |
|
1741 end |
|
1742 else |
|
1743 begin |
|
1744 ParseCommandOverride:= lua_tostring(luaState, -1); |
|
1745 lua_pop(luaState, 1) |
|
1746 end; |
1725 end; |
1747 end; |
1726 |
1748 |
1727 function ScriptCall(fname : shortstring; par1: LongInt) : LongInt; |
1749 function ScriptCall(fname : shortstring; par1: LongInt) : LongInt; |
1728 begin |
1750 begin |
1729 ScriptCall:= ScriptCall(fname, par1, 0, 0, 0) |
1751 ScriptCall:= ScriptCall(fname, par1, 0, 0, 0) |