Author: anonymissimus
Date: Wed Oct 12 23:44:42 2011
New Revision: 51455

URL: http://svn.gna.org/viewcvs/wesnoth?rev=51455&view=rev
Log:
exposed config::debug() in the lua interface

The functionality is actually covered by the dbms function
I wrote in the WLP, but may be easier to find and use. It would have
been useful for me at least, until I had written that function.

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=51455&r1=51454&r2=51455&view=diff
==============================================================================
--- trunk/src/scripting/lua.cpp (original)
+++ trunk/src/scripting/lua.cpp Wed Oct 12 23:44:42 2011
@@ -1935,6 +1935,19 @@
        chat_message(h, m);
        LOG_LUA << "Script says: \"" << m << "\"\n";
        return 0;
+}
+
+/**
+ * Dumps a wml table or userdata wml object into a pretty string.
+ * - Arg 1: wml table or vconfig userdata
+ * - Ret 1: string
+ */
+static int intf_debug(lua_State* L)
+{
+       const config& arg = luaW_checkconfig(L, 1);
+       const std::string& result = arg.debug();
+       lua_pushstring(L, result.c_str());
+       return 1;
 }
 
 /**
@@ -3393,6 +3406,7 @@
                { "compare_versions",         &intf_compare_versions         },
                { "copy_unit",                &intf_copy_unit                },
                { "create_unit",              &intf_create_unit              },
+               { "debug",                    &intf_debug                    },
                { "delay",                    &intf_delay                    },
                { "dofile",                   &intf_dofile                   },
                { "eval_conditional",         &intf_eval_conditional         },


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

Reply via email to