hedgewars/uScript.pas
changeset 5118 9cfdb9bc6140
parent 5075 59b13b38a827
child 5120 c4d5ddf939fc
--- a/hedgewars/uScript.pas	Thu Apr 07 13:26:56 2011 +0200
+++ b/hedgewars/uScript.pas	Thu Apr 07 11:30:56 2011 -0400
@@ -180,8 +180,10 @@
 function lc_addcaption(L : Plua_State) : LongInt; Cdecl;
 begin
     if lua_gettop(L) = 1 then
+        AddCaption(lua_tostring(L, 1), cWhiteColor, capgrpMessage)
+    else if lua_gettop(L) = 3 then
         begin
-        AddCaption(lua_tostring(L, 1), cWhiteColor, capgrpMessage);
+        AddCaption(lua_tostring(L, 1), lua_tointeger(L, 2) shr 8, TCapGroup(lua_tointeger(L, 3)));
         end
     else
         LuaError('Lua: Wrong number of parameters passed to AddCaption!');
@@ -1555,7 +1557,8 @@
     vgt: TVisualGearType;
     am : TAmmoType;
     st : TSound;
-    he: THogEffect;
+    he : THogEffect;
+    cg : TCapGroup;
     s, t : ansistring;
 begin
 // initialize lua
@@ -1645,6 +1648,9 @@
 for he:= Low(THogEffect) to High(THogEffect) do
     ScriptSetInteger(EnumToStr(he), ord(he));
 
+for cg:= Low(TCapGroup) to High(TCapGroup) do
+    ScriptSetInteger(EnumToStr(cg), ord(cg));
+
 // register functions
 lua_register(luaState, 'band', @lc_band);
 lua_register(luaState, 'bor', @lc_bor);