Author: silene
Date: Fri May  8 10:41:30 2009
New Revision: 35481

URL: http://svn.gna.org/viewcvs/wesnoth?rev=35481&view=rev
Log:
Added Lua accessor for the entire WML table of a unit.

Modified:
    trunk/src/scripting/lua.cpp

Modified: trunk/src/scripting/lua.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/scripting/lua.cpp?rev=35481&r1=35480&r2=35481&view=diff
==============================================================================
--- trunk/src/scripting/lua.cpp (original)
+++ trunk/src/scripting/lua.cpp Fri May  8 10:41:30 2009
@@ -304,6 +304,15 @@
                return 1; \
        }
 
+#define return_cfg_attrib(name, accessor) \
+       if (strcmp(m, name) == 0) { \
+               config cfg; \
+               accessor; \
+               lua_newtable(L); \
+               table_of_wml_config(L, cfg); \
+               return 1; \
+       }
+
 #define modify_tstring_attrib(name, accessor) \
        if (strcmp(m, name) == 0) { \
                if (lua_type(L, -1) == LUA_TUSERDATA) { \
@@ -372,6 +381,7 @@
        return_bool_attrib("canrecruit", u.can_recruit());
        return_bool_attrib("petrified", u.incapacitated());
        return_bool_attrib("resting", u.resting());
+       return_cfg_attrib("__cfg", u.write(cfg));
        return 0;
 }
 


_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits

Reply via email to