wesnoth/data/lua/wml-conditionals.lua
Charles Dang da3a0ed7cf Added [lua] conditional tag
Also made conditions fail if they encountered a syntax or runtime error. This seems the
more logical behavior than passing.

WML conditional tags were split into their own Lua file. The one in lua/wml/object.lua
relies on local variables so was left there.
2018-01-22 23:03:16 +11:00

23 lines
505 B
Lua

local helper = wesnoth.require "helper"
function wesnoth.wml_conditionals.proceed_to_next_scenario(cfg)
local endlevel_data = wesnoth.get_end_level_data()
if not endlevel_data then
return false
else
return endlevel_data.proceed_to_next_level
end
end
function wesnoth.wml_conditionals.lua(cfg)
cfg = helper.shallow_literal(cfg)
local bytecode, message = load(cfg.code or "")
if not bytecode then
error("~lua:" .. message, 0)
else
return bytecode(helper.get_child(cfg, "args"))
end
end