# HG changeset patch # User Wuzzy # Date 1508813300 -7200 # Node ID 1df909b46c05448ef422e9ab5470875955ed94d8 # Parent aa96dec39da812326be007728eaa9168d407781c Lua API: Fix Goals text being cut off at ca. 255 characters diff -r aa96dec39da8 -r 1df909b46c05 ChangeLog.txt --- a/ChangeLog.txt Tue Oct 24 04:06:03 2017 +0200 +++ b/ChangeLog.txt Tue Oct 24 04:48:20 2017 +0200 @@ -381,6 +381,7 @@ * Fixed call: HideHog(gear) -- Fix crash when gear is invalid. Returns true on success or false otherwise * Fixed call: SwitchHog(gear) -- Fix new hog being unable to open ammo menu * Removed call: SetAmmoStore -- Old undocumented function of questional use, has never been used + * Fixed variable: Goals -- Fix Goals text being cut off at ca. 255 characters * Fix huge numbers having sign errors on 64-bit architectures ====================== 0.9.22 ====================== diff -r aa96dec39da8 -r 1df909b46c05 hedgewars/uScript.pas --- a/hedgewars/uScript.pas Tue Oct 24 04:06:03 2017 +0200 +++ b/hedgewars/uScript.pas Tue Oct 24 04:48:20 2017 +0200 @@ -2887,6 +2887,13 @@ lua_pop(luaState, 1); end; +function ScriptGetAnsiString(name : shortstring) : ansistring; +begin + lua_getglobal(luaState, Str2PChar(name)); + ScriptGetAnsiString:= lua_tostringa(luaState, -1); + lua_pop(luaState, 1); +end; + procedure ScriptOnPreviewInit; begin // not required if there is no script to run @@ -2982,7 +2989,7 @@ ParseCommand('map ' + ScriptGetString('Map'), true, true); if ScriptGetString('Theme') <> '' then ParseCommand('theme ' + ScriptGetString('Theme'), true, true); -LuaGoals:= ScriptGetString('Goals'); +LuaGoals:= ScriptGetAnsiString('Goals'); // Support lua changing the ammo layout - assume all hogs have same ammo, note this might leave a few ammo stores lying around. k:= 0; diff -r aa96dec39da8 -r 1df909b46c05 hedgewars/uVariables.pas --- a/hedgewars/uVariables.pas Tue Oct 24 04:06:03 2017 +0200 +++ b/hedgewars/uVariables.pas Tue Oct 24 04:48:20 2017 +0200 @@ -244,7 +244,7 @@ hiTicks: Word; - LuaGoals : shortstring; + LuaGoals : ansistring; LuaTemplateNumber : LongWord;