Lua API: Add WriteLnToChat
authorWuzzy <Wuzzy2@mail.ru>
Wed, 07 Feb 2018 01:54:50 +0100
changeset 12915 383445810e42
parent 12914 b5d3b79c90cf
child 12916 20f389ae90b5
Lua API: Add WriteLnToChat
ChangeLog.txt
hedgewars/uScript.pas
--- a/ChangeLog.txt	Wed Feb 07 01:13:17 2018 +0100
+++ b/ChangeLog.txt	Wed Feb 07 01:54:50 2018 +0100
@@ -13,6 +13,9 @@
  + Mission 3: Display number of turns left at timed parcours
  * Fix incorrect storytelling in mission descriptions
 
+Lua API:
+ + New call: WriteLnToChat(string): Add a line in the chat
+
 ====================== 0.9.23 ======================
 HIGHLIGHTS:
  + Battalion style
--- a/hedgewars/uScript.pas	Wed Feb 07 01:13:17 2018 +0100
+++ b/hedgewars/uScript.pas	Wed Feb 07 01:54:50 2018 +0100
@@ -404,6 +404,13 @@
     lc_writelntoconsole:= 0;
 end;
 
+function lc_writelntochat(L : Plua_State) : LongInt; Cdecl;
+begin
+    if CheckLuaParamCount(L, 1, 'WriteLnToChat', 'string') then
+        AddChatString(#2 + lua_tostring(L, 1));
+    lc_writelntochat:= 0;
+end;
+
 function lc_parsecommand(L : Plua_State) : LongInt; Cdecl;
 var t: PChar;
     i,c: LongWord;
@@ -3572,6 +3579,7 @@
 lua_register(luaState, _P'SpawnFakeAmmoCrate', @lc_spawnfakeammocrate);
 lua_register(luaState, _P'SpawnFakeUtilityCrate', @lc_spawnfakeutilitycrate);
 lua_register(luaState, _P'WriteLnToConsole', @lc_writelntoconsole);
+lua_register(luaState, _P'WriteLnToChat', @lc_writelntochat);
 lua_register(luaState, _P'GetGearType', @lc_getgeartype);
 lua_register(luaState, _P'EndGame', @lc_endgame);
 lua_register(luaState, _P'EndTurn', @lc_endturn);