Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use to-be-closed variables to scope WML variables in tag definitions (#…
- Loading branch information
1 parent
a2d676e
commit a0ee38a
Showing
8 changed files
with
77 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{GENERIC_UNIT_TEST "test_scoped_vars" ( | ||
[event] | ||
name = prestart | ||
{VARIABLE test_var 1} | ||
#[inspect][/inspect] | ||
{ASSERT {VARIABLE_CONDITIONAL test_var equals 1}} | ||
[lua] | ||
code = << | ||
local wml_utils = wesnoth.require "wml-utils" | ||
local var <close> = wml_utils.scoped_var("test_var") | ||
-- This runs the contents of [args] as WML actions | ||
wml_utils.handle_event_commands(...) | ||
>> | ||
[args] | ||
#[inspect][/inspect] | ||
{ASSERT {VARIABLE_CONDITIONAL test_var equals ""}} | ||
{VARIABLE test_var 5} | ||
#[inspect][/inspect] | ||
{ASSERT {VARIABLE_CONDITIONAL test_var equals 5}} | ||
[/args] | ||
[/lua] | ||
|
||
#[inspect][/inspect] | ||
{ASSERT {VARIABLE_CONDITIONAL test_var equals 1}} | ||
{SUCCEED} | ||
[/event] | ||
)} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters