Author: silene
Date: Sun Mar 22 19:59:33 2009
New Revision: 34043

URL: http://svn.gna.org/viewcvs/wesnoth?rev=34043&view=rev
Log:
Added a boolean parameter to wesnoth.get_variable for faster queries.

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=34043&r1=34042&r2=34043&view=diff
==============================================================================
--- trunk/src/scripting/lua.cpp (original)
+++ trunk/src/scripting/lua.cpp Sun Mar 22 19:59:33 2009
@@ -392,8 +392,9 @@
 }
 
 /**
- * Sets a WML variable.
+ * Gets a WML variable.
  * - Arg1: string containing the variable name.
+ * - Arg2: optional bool indicating if tables for containers should be left 
empty.
  * - Ret1: value of the variable, if any.
  */
 static int lua_get_variable(lua_State *L)
@@ -407,7 +408,8 @@
                variable_info w(m, false, variable_info::TYPE_CONTAINER);
                if (w.is_valid) {
                        lua_newtable(L);
-                       table_of_wml_config(L, w.as_container());
+                       if (lua_toboolean(L, 2))
+                               table_of_wml_config(L, w.as_container());
                        return 1;
                }
        }


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

Reply via email to