39 Commits

Author SHA1 Message Date
Celtic Minstrel
aaa2dc4ece Rollback possibility of wesnoth.get_units matching recall list units
Now it's renamed to wesnoth.units.find_on_map.

wesnoth.units.find implements the case of finding units on either the map or a recall list.
2019-11-15 22:39:09 -05:00
Celtic Minstrel
6a87f5d48d Remove Lua implementation of wesnoth.units.find_on_recall
Since there's already a native C++ version we might as well just use it.
2019-11-15 22:39:08 -05:00
Celtic Minstrel
977f05d77f Lua: Replace uses of deprecated (moved) unit functions
Also backtracked the removal of wesnoth.get_recall_units, which is now available as wesnoth.units.find_on_recall - it's just more convenient than passing x=recall to wesnoth.units.find
2019-11-15 22:39:08 -05:00
Celtic Minstrel
4dc986f028 Lua: Flip functions moved to the units module
This means that they are now added to the units module by default in C++, and only duplicated to the Wesnoth module in Lua.

Some additional functions were moved:
- wesnoth.create_unit -> wesnoth.units.create
- wesnoth.get_units -> wesnoth.units.find
- wesnoth.get_unit -> wesnoth.units.get

Deprecated wesnoth.get_recall_units in favour of wesnoth.get_units, which has gained the ability to match units on the recall list if x="recall" or y="recall" appears in the filter at toplevel.

The wesnoth.units module now acts like a metatable for unit userdata, meaning that any functions (or attributes) added to the module will be visible through any unit.
2019-11-15 22:39:08 -05:00
Celtic Minstrel
36dc3200c5 Lua: Flip functions moved to the wml module
This means that they are now added to the WML module by default in C++, and only duplicated to the Wesnoth module in Lua.
2019-11-13 00:40:29 -05:00
josteph
21823d9332 Lua: Fix wesnoth.deprecate_api for the case of deprecating a table that had a metamethod other than __index/__newindex 2019-09-26 12:17:05 +00:00
josteph
56131f14c4 lua: Fix a bug when calling wesnoth.deprecate_api on a table that had a metatable.
The old metatable was used as the metatable of the new element's
metatable, which doesn't make any sense at all.

Fixes #4079
2019-09-26 12:17:05 +00:00
Jyrki Vesterinen
68f3a8e846 Lua fixes 2018-11-16 05:47:28 +02:00
Celtic Minstrel
6d7736e6e6 Deprecate helper.wml_error and move it to wml.error 2018-11-15 21:06:55 -05:00
Celtic Minstrel
8bcf749666 Lua API reorganization: units module deprecations 2018-11-15 21:06:55 -05:00
Celtic Minstrel
7c3fd9a612 Lua API reorganization: units module 2018-11-15 21:06:55 -05:00
Celtic Minstrel
3e79b3bde8 Lua API reorganization: GUI module deprecations 2018-11-15 21:06:55 -05:00
Celtic Minstrel
3ec9ce4b60 Lua API reorganization: GUI module 2018-11-15 21:06:55 -05:00
Celtic Minstrel
55a6c16810 Lua API reorganization: interface module deprecations 2018-11-15 21:06:55 -05:00
Celtic Minstrel
e3e80b4a99 Lua API reorganization: interface module 2018-11-15 21:06:55 -05:00
Celtic Minstrel
20e85aa417 Lua API: Add wml.load and wml.parse functions 2018-11-11 16:01:08 -05:00
mattsc
a0decde7b9 Lua code: replace deprecated wesnoth.get_all_vars() calls
(cherry-picked from commit 64f7ad256022426040ef9e13ad7941b6bec789a8)
2018-10-07 03:21:08 +00:00
mattsc
0e017d9f7c Lua code: replace deprecated wesnoth.set_variable() calls
(cherry-picked from commit ce7faae4f41f23f1d1f61d2b4f5ca95d4ce4f89a)
2018-10-07 03:21:07 +00:00
mattsc
76ec65102c Prevent definition of wml.variables to cause deprecation warnings
(cherry-picked from commit 0f157bff27fd4db281695710c059b7898d394e8a)
2018-10-07 03:21:07 +00:00
mattsc
05d5afa6a9 Lua code: replace deprecated wesnoth.get_variable() calls
(cherry-picked from commit f1764d182fe33c4e29c6bd42761be2e946cd0c94)
2018-10-07 03:21:06 +00:00
Celtic Minstrel
83a6243fb9 Fix incorrect error message when encountering an unknown persistent tag
(cherry-picked from commit d2a8c5bb3200898a068aa24b7b968e444c7dc851)
2018-10-07 03:18:45 +00:00
Celtic Minstrel
5008c72a22
Fixup wml.all_variables 2018-03-18 01:38:39 -04:00
Celtic Minstrel
ddcbb4cb50 Add a more convenient way of registering custom saved game data 2018-03-17 17:16:22 -04:00
Celtic Minstrel
68d545c3be Add a couple more WML utility functions 2018-03-17 16:48:06 -04:00
Celtic Minstrel
08ec9017b5 Lua API: Some tweaks of the experimental wml module 2018-03-17 16:48:00 -04:00
Charles Dang
0103959c36 Cleaned up deprecated API usage in core Lua
[ci skip]
2018-03-13 16:55:36 +11:00
Celtic Minstrel
dabf09fce1 Fix deprecation spam
This removes the Lua deprecation_message function in favour of exposing the C++ variant to Lua instead.
It also moves all deprecation messages to a separate logdomain, making them easily enabled en masse.
2018-03-04 21:21:33 -05:00
Celtic Minstrel
3440546f2d Some fixes to the Lua deprecation API, and extend it to C++
* Some improvements to the messages
* Don't clobber existing metatables on deprecated subtables
* Fix Lua deprecation messages not even being logged
* Fix deprecation of Lua subtables
* Don't clobber the metatable when deprecating a subtable
2018-02-12 00:09:48 -05:00
Celtic Minstrel
4b58a52140
Shouldn't have the same __metatable for two metatables 2018-02-06 00:15:22 -05:00
Charles Dang
5134033e30 Name __metatable for wml.variables
[ci skip]
2018-02-06 16:10:29 +11:00
vgaming
8ba6e5f40e fix code problems found by luacheck (#2380)
actual bugs found:
* backwards_compatibility.lua (undeclared global "helper")
* core.lua (use of undeclared global "helper")
* wml_tags.transform_unit had wrong code to deal with recall_cost
* wrong variable name in cave_map_generator
2018-01-20 23:05:58 -05:00
V N
5209271db3 Lua: add variables metatable
The implementation differs from already-existing
wml.variable.proxy in that it does not try to proxy table sub-fields,
and is fast & simple.

Example usage:
wml.variables.test = 123
print(wml.variables.test)
2018-01-19 09:53:06 +11:00
Celtic Minstrel
00443dd8a4 Fixup d192d0712393 and move wesnoth.debug() to lua_kernel_base 2017-08-14 13:10:52 -04:00
Celtic Minstrel
d192f07123 Implement standard deprecation system for Lua API
(as proposed by @DeFender1031)

All existing deprecation messages in the Lua code have been changed to
use the new deprecation system.

The goal is to eventually use an equivalent system for ALL areas of the API.
2017-08-14 12:36:09 -04:00
Celtic Minstrel
fdf50bccd1 core.lua: Explicitly load wml.variable only in Game Lua Kernel 2017-05-23 23:55:43 -04:00
Celtic Minstrel
f42852dd0c Minor rearrangement/fixup in core.lua 2017-05-23 23:55:42 -04:00
Celtic Minstrel
9f0c677d02 Remove the optional second argument to wesnoth.get_variable
It was only used in one place and didn't even function as advertised.
2017-05-22 17:31:21 -04:00
Celtic Minstrel
c0f926e2ed Move all WML and variable manipulator functions into new wml table
(The old functions in wesnoth and helper are still available,
but they are now deprecated.)
2017-05-22 17:31:14 -04:00
Celtic Minstrel
2f15a08b78 Add a Lua file for things to be automatically loaded by the engine in all contexts 2017-05-04 20:17:00 -04:00