mattsc
a1de3a0d72
wesnoth.units.find_attack: also return attack index
2019-12-19 07:05:10 -08:00
Celtic Minstrel
55fa2759a1
Fix the test_move_unit_in_circle test
...
Just needed to extract the unit earlier, so that it wouldn't be counted as blocking itself
Closes #4635
2019-12-14 12:12:29 -05:00
jostephd
bb583c8e98
Merge pull request #4612 from jostephd/lua-deprecate_api-__index-__newindex-simplify
...
lua: Simplify the __index and __newindex wrappers in wesnoth.deprecate_api
2019-12-14 14:15:09 +00:00
josteph
1df045fba0
fixup! lua: Simplify the __index and __newindex wrappers in wesnoth.deprecate_api
2019-12-14 14:14:12 +00:00
Celtic Minstrel
b8759f8c19
Add some additional cases to the move_unit test, and fix a few issues that they revealed
...
One of the cases fails due to something in find_vacant_tile - perhaps someone else can figure out how to fix this?
If nothing else, setting check_passability=no in the [move_unit] should do it, but I'd prefer not to have to do that...
2019-12-10 21:16:06 -05:00
Celtic Minstrel
cbd88814c3
Fix #4622
2019-12-09 22:12:39 -05:00
Celtic Minstrel
c366998021
Fix an issue with items and location sets
...
Fixes #4621
2019-12-07 17:21:03 -05:00
Celtic Minstrel
e009989ec3
Fix some places that were erroneously calling string.format instead of stringx.vformat after 30240aa7cda41bd5c1a660f17c67e76a9b9ab2cd
...
Fixes #4621
2019-12-07 17:21:03 -05:00
Celtic Minstrel
ee40ca2146
Lua uses nil, not null. Oops!
2019-12-07 17:21:03 -05:00
Celtic Minstrel
d66e957e1d
Fix ilua's strict mode
2019-12-07 14:48:55 -05:00
Celtic Minstrel
29e11e7914
Lua functional library: make reduce accept an operator name in place of a function, add zip
2019-12-07 13:52:49 -05:00
Steve Cotton
4e92cc46ad
Fix move_unit's parsing of to_x and to_y (fixes the unit-test timeout)
...
Also extend the unit test to at least check the end result of comma-separated
values, as there was previously nothing testing the effect of providing more
than one value.
2019-12-07 18:41:32 +01:00
Celtic Minstrel
0b433d7ca1
Implement a Lua strict mode which eliminates all deprecated things
...
Note: At present the only way to enable this is by editing the core.lua file to add the line "wesnoth.strict = true".
2019-12-04 21:52:47 -05:00
Celtic Minstrel
9ae3be7386
Add stringx functions for parsing ranges
2019-12-04 08:55:17 -05:00
Celtic Minstrel
7a1390adf7
Remove "wml-utils" require from files that no longer use it
2019-12-04 08:48:53 -05:00
Celtic Minstrel
f2f35cbd38
Fix broken [move_units]dir=
2019-12-04 08:46:22 -05:00
Celtic Minstrel
d9b5e3c4df
Replace uses of wml_utils.split with stringx.split
2019-12-04 08:46:04 -05:00
Celtic Minstrel
31467d29d7
Deprecate wml_utils.split in favour of stringx.split
2019-12-04 08:09:51 -05:00
Celtic Minstrel
34cce96a58
Deprecate wml_utils.parenthetical_split in favour of stringx.split
...
There were no uses of this function in core Lua files.
2019-12-04 08:07:15 -05:00
Celtic Minstrel
4eb043bb16
Deprecate wml_utils.trim in favour of stringx.trim and update all use cases
2019-12-04 00:53:59 -05:00
Celtic Minstrel
e81a0377b0
Update uses of moved format functions
2019-12-04 00:50:00 -05:00
Celtic Minstrel
533206674a
Deprecate wesnoth.wml_matches_filter
2019-12-04 00:47:29 -05:00
Celtic Minstrel
7ee7d6d47c
Lua: More stuff for the stringx module
...
- Move format_conjunct_list and format_disjunct_list
- Move wesnoth.format (renamed to vformat so as not to conflict with string.format); it's also available as tstr:format()
- Add stringx.trim
- The convenience wrappers of stringx.split now set the remove_empty and strip_space flags
2019-12-04 00:45:36 -05:00
Celtic Minstrel
027be31826
Add wml.interpolate function for vconfig interpolation from a source other than the game variables
...
Unlike wml.tovconfig, this method works even in the plugin and map generation contexts.
2019-12-02 22:45:06 -05:00
Celtic Minstrel
11a57e0fa7
Move helper.find_attack -> wesnoth.units.find_attack
2019-12-02 22:39:34 -05:00
Celtic Minstrel
d5c1c9734f
Fix the deprecated helper.set_wml_tag_metatable using a non-existent core table
2019-12-02 22:39:34 -05:00
Celtic Minstrel
732b7942bb
Replace all references to deprecated functions in the helper module
...
(and remove the require if this meant it was no longer used)
2019-12-02 01:10:34 -05:00
Celtic Minstrel
74e004c265
Use a location set in the implementation of the item functions and WML tags
2019-12-01 22:30:31 -05:00
Celtic Minstrel
4b9f5d4485
Extend the location_set module to support set operators, custom index operators, and a tostring metamethod
...
Also adds set difference and symmetric difference functions, and a clone function.
2019-12-01 22:29:49 -05:00
Celtic Minstrel
9da5d4adfd
fixup! Declare wesnoth.interface.remove_overlay directly instead of declaring it local and then assigning it
...
Missed updating the deprecation line and used the wrong new name
2019-12-01 21:50:56 -05:00
Celtic Minstrel
57bb4224b0
Declare wesnoth.interface.remove_overlay directly instead of declaring it local and then assigning it
2019-12-01 20:25:47 -05:00
Celtic Minstrel
aa5ac6af29
Add stringx module that exposes Wesnoth's split/join functions to Lua
...
The built-in string module is set as the metatable index for the stringx module, and the stringx module is set as the metatable index for strings, meaning all string and stringx methods are available through (''):method_name.
This also enables direct indexing of strings to get individual characters (ie ('str')[1] and the like), which package.lua already assumed even though it didn't work. Negative indices are supported to, and index from the end of the srring.
New functions:
- stringx.split
- stringx.parenthetical_split
- stringx.map_split
- stringx.escaped_split
- stringx.quoted_split
- stringx.anim_split
- stringx.join
- stringx.join_map
2019-12-01 20:25:13 -05:00
Celtic Minstrel
86f66a5825
Lua: Add a few more useful functions to the WML module and make WML table conversion a little more robust
...
- New functions: wml.find_child, wml.attribute_count, wml.equal, wml.valid
- When converting a Lua table to WML, the engine will no longer accept invalid attributes
- Use of wml.tovconfig in plugin or map generation scripts is deprecated (it already doesn't quite work properly in those contexts but still could've been used as a way to test a table's validity as WML)
2019-12-01 20:25:13 -05:00
josteph
3ea5ee5f70
lua: Simplify the __index and __newindex wrappers in wesnoth.deprecate_api
...
Should fix one of the two issues discussed in #4584 . See https://github.com/wesnoth/wesnoth/issues/4584#issuecomment-560029352
2019-12-01 06:08:33 +00:00
Celtic Minstrel
5a27cd5b1b
Also correct the dperecation message regarding the previous commit
...
[ci skip]
2019-11-29 00:36:47 -05:00
Celtic Minstrel
c7e84f487c
Correct old names for some deprecated (renamed) unit functions
...
Fixes #4608
2019-11-29 00:33:36 -05:00
Celtic Minstrel
b7a358c4af
Fix a typo
2019-11-23 15:25:06 -05:00
Celtic Minstrel
859ab37254
Lua: Fix deprecate_api changing the behaviour of tables with an __index metamethod
2019-11-23 14:44:25 -05:00
Celtic Minstrel
3734bce276
Lua: Replace uses of deprecated (moved) sides functions
2019-11-23 14:41:03 -05:00
Celtic Minstrel
930e39422a
Lua side proxy now has starting_location member (replaces wesnoth.get_starting_location())
2019-11-23 14:37:41 -05:00
Celtic Minstrel
153680400d
Unify the Lua and WFL interfaces to the movement type
...
See changelog for details.
2019-11-23 00:59:36 -05:00
jostephd
4b3a7c0800
core.lua: Link to #4584 in a comment near the new warning
2019-11-22 19:19:53 +00:00
Celtic Minstrel
981fa93a40
Make ilua output iterable userdata as tables
...
This means anything with __len and __pairs metamethods.
2019-11-17 14:23:59 -05:00
Celtic Minstrel
ece5490fd9
Improve ilua's table output for tables that have both an array part and additional keys
...
Previously for such tables it would just show the array part and ignore the rest.
2019-11-17 14:23:59 -05:00
Celtic Minstrel
d53ac4b496
Fix ilua not honouring __tostring functions for tables
...
This gives ilua full access to the debug module so that it can determine whether the table's metatable contains __tostring
2019-11-17 14:23:59 -05:00
Celtic Minstrel
12bb52fd4e
Warn if trying to deprecate a table whose metatable is masked
2019-11-17 14:23:58 -05:00
Celtic Minstrel
212a91113c
Convert wesnoth.sides to a module and move several functions to it
...
The old names still work but are deprecated.
In addition, all the moved functions now accept either a side number or a side userdata as the first parameter.
2019-11-17 11:35:56 -05:00
Celtic Minstrel
c27863b6f5
Alias wesnoth.interface.scroll_to_hex to wesnoth.units.scroll_to
2019-11-16 17:12:27 -05:00
Celtic Minstrel
e0cf8c5982
Fix syntax error (trying to write Lua like C++)
2019-11-16 17:01:43 -05:00
Celtic Minstrel
cd6283f8db
Add a few more tags to the [modify_unit] optimized path
2019-11-16 15:14:09 -05:00