Skip to content

Commit

Permalink
Removed sanity check for missing [do] in [while]
Browse files Browse the repository at this point in the history
  • Loading branch information
Elvish-Hunter committed Apr 12, 2014
1 parent 84722f5 commit c35e08d
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions data/lua/wml-tags.lua
Expand Up @@ -334,22 +334,13 @@ wml_actions.command = handle_event_commands
-- the table, using the [] operator, rather than by using the point syntax

wml_actions["if"] = function( cfg )
-- raise error if [then] is missing
--if not helper.get_child( cfg, "then" ) then
-- helper.wml_error "[if] missing required [then] tag"
--end

if wesnoth.eval_conditional( cfg ) then -- evalutate [if] tag
for then_child in helper.child_range ( cfg, "then" ) do
handle_event_commands( then_child )
end
return -- stop after executing [then] tags
else
for elseif_child in helper.child_range ( cfg, "elseif" ) do
-- there's no point in executing [elseif] without [then]
--if not helper.get_child( elseif_child, "then" ) then
-- helper.wml_error "[elseif] missing required [then] tag"
--end
if wesnoth.eval_conditional( elseif_child ) then -- we'll evalutate the [elseif] tags one by one
for then_tag in helper.child_range( elseif_child, "then" ) do
handle_event_commands( then_tag )
Expand All @@ -365,11 +356,7 @@ wml_actions["if"] = function( cfg )
end

wml_actions["while"] = function( cfg )
-- check if the [do] sub-tag is missing, and raise error if so
if not helper.get_child( cfg, "do" ) then
helper.wml_error "[while] missing required [do] tag"
end
-- we have at least one [do], execute them up to 65536 times
-- execute [do] up to 65536 times
for i = 1, 65536 do
if wesnoth.eval_conditional( cfg ) then
for do_child in helper.child_range( cfg, "do" ) do
Expand Down

0 comments on commit c35e08d

Please sign in to comment.