Author: fendrin
Date: Wed Apr 22 19:57:13 2009
New Revision: 35124
URL: http://svn.gna.org/viewcvs/wesnoth?rev=35124&view=rev
Log:
New wml tag wml_action that can define new action wml tags.
Modified:
trunk/data/lua/wml-tags.lua
Modified: trunk/data/lua/wml-tags.lua
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/data/lua/wml-tags.lua?rev=35124&r1=35123&r2=35124&view=diff
==============================================================================
--- trunk/data/lua/wml-tags.lua (original)
+++ trunk/data/lua/wml-tags.lua Wed Apr 22 19:57:13 2009
@@ -149,8 +149,31 @@
end
end
+local function wml_action_tag(cfg)
+ -- The new tag's name
+ -- TODO make this attribute mandatory
+ local name = cfg.name
+ -- The lua function that is executed when the tag is called
+ -- TODO make this attribute mandatory
+
+ -- debug output
+ for tag in child_range(cfg, "tag") do
+ wesnoth.message(tag.name)
+ end
+
+ -- debug output
+ for attribute in child_range(cfg, "attribute") do
+ wesnoth.message(attribute.name)
+ end
+
+ local lua_function = assert(loadstring(cfg.lua_function)())
+ wesnoth.register_wml_action(name, lua_function)
+end
+
wesnoth.register_wml_action("objectives", wml_objectives)
wesnoth.register_wml_action("show_objectives", wml_show_objectives)
wesnoth.register_wml_action("gold", wml_gold)
wesnoth.register_wml_action("store_gold", wml_store_gold)
wesnoth.register_wml_action("clear_variable", wml_clear_variable)
+wesnoth.register_wml_action("wml_action", wml_action_tag)
+
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits