Commit graph

59 commits

Author SHA1 Message Date
mattsc
51b2dbec19 Lua code: replace deprecated wesnoth.set_variable() calls 2018-05-12 17:41:28 -07:00
mattsc
2922b19802 Lua code: replace deprecated wesnoth.get_variable() calls 2018-05-10 19:55:31 -07:00
Celtic Minstrel
e776635023 Clear up redundancies in helper compatibility and deprecate the array functions 2018-03-17 16:48:03 -04:00
Celtic Minstrel
6e4d09d2a5 Bump up a couple of deprecation levels at @vultraz's request 2018-03-17 16:48:01 -04:00
Celtic Minstrel
08ec9017b5 Lua API: Some tweaks of the experimental wml module 2018-03-17 16:48:00 -04: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
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
fbeb6c5b09 Add helper.find_attack and clean up the [animate_unit] / [kill] hack regarding death / victory animations 2017-05-28 18:20:16 -04:00
Celtic Minstrel
646bedb088 Reverse the Lua API deprecations for the time being. 2017-05-26 20:50:37 -04:00
Celtic Minstrel
2fe72820d1 Fix Lua deprecation warnings being shown in chat outside debug mode 2017-05-23 23:55:44 -04:00
Celtic Minstrel
62ac5a6897 fixup 30caf6149a 2017-05-22 20:29:19 -04:00
Celtic Minstrel
30caf6149a Show Lua deprecation warnings to chat only in debug mode, but always log them too 2017-05-22 17:31:17 -04:00
Celtic Minstrel
8492e8d639 Use standard deprecation mechanism for helper.distance_between 2017-05-22 17:31:15 -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
b11371dbfa Lua: Allow helper.set_variable_array and helper.get_variable_array to work on units and sides 2017-05-11 16:00:56 -04:00
Celtic Minstrel
a98a9a74db Deprecate helper.distance_between and implement helper.adjacent_tiles in
terms of wesnoth.map.get_adjacent_tiles
2017-05-10 17:40:15 -04:00
Celtic Minstrel
71ae14e851 Some minor improvements to Lua error messages
- Fix some missing whitespace in Lua log/error messages and add colons
- helper.lua: Improve error messages for config manipulators

It should now give the location of the misused helper call as the error
location, rather than the location where error was called within helper.lua
2017-05-06 17:47:17 -04:00
gfgtdf
8c4e09e940 allow to to use a custom rng in helper.rand 2017-04-07 15:05:56 +02:00
Charles Dang
d89730410b Improve ensure_config error messages 2017-03-01 11:58:33 +11:00
Celtic Minstrel
80cdac5b89 fixup! Improve error message when Lua config helper functions are not passed a config as the first argument 2017-02-28 19:15:57 -05:00
Celtic Minstrel
8319fee1f8 Improve error message when Lua config helper functions are not passed a config as the first argument 2017-02-28 19:03:41 -05:00
Gregory A Lundberg
edacf922fb Lua upgrade: integer indices
As of version 5.3, Lua converts a number which as an integer value to add ".0" to the end.

Updating mainline to avoid the issue.
2016-10-21 23:09:51 -05:00
Celtic Minstrel
79647ff9d9 helper.lua: set __metatable field to guard against external access to metatables 2016-10-10 17:41:23 -04:00
Bär Halberkamp
1d8d843a80 move set_variable.rand's logic to helper.rand 2016-07-19 13:48:31 -04:00
CelticMinstrel
f31084da84 Remove asserts 2015-09-29 20:56:34 -04:00
Celtic Minstrel
9aa015a57a Fix helper.child_range to work on config and vconfig alike 2015-09-29 20:04:03 -04:00
Celtic Minstrel
2c337d4115 Use ipairs() for helper.child_range 2015-09-29 14:46:41 -04:00
Celtic Minstrel
7fb0831da6 Use ipairs for the helper functions 2015-09-29 12:55:31 -04:00
Celtic Minstrel
03a38c5294 Lua API: More helper functions for configs 2015-09-26 02:43:59 -04:00
gfgtdf
0038448fcb make helper.shuffle synced
using helper.shuffle now doesn't casue OOS anymore used. It is possible
to get the old behaviour by passing math.random as a second parameter.
2015-08-04 22:36:54 +02:00
Alexander van Gessel
62b287354f Fix Fisher-Yates implemenation of Lua helper.shuffle (bug #21706) 2014-03-04 11:57:19 +01:00
J. Tyne
70351c6209 Improve the implementation of parenthetical_split()...
...and make it local to wml_actions.remove_unit_overlay().
2013-01-25 22:10:57 +00:00
J. Tyne
110484bca6 Add a variant on parenthetical_split() to helper.lua...
...and use it to fix bug #20401.

If no problems are found with this approach, I can backport it to stable.
2013-01-05 23:47:53 +00:00
Elvish_Hunter
aab7c8afcf Lua: added new helper.shuffle() function 2013-01-03 13:22:15 +00:00
Elvish_Hunter
6bfaa5ef88 Lua: added helper.round function 2012-04-12 10:12:05 +00:00
Anonymissimus
6569d72ada update helper.lua to use wesnoth.wml_actions instead of wesnoth.fire
(patch #3040 by SigurdFireDragon, slightly modified)
2012-02-08 21:28:02 +00:00
Anonymissimus
afb54cfc76 remove the string "WML" in helper.deprecate,
...since we're using it for lua functions as well
2012-02-07 23:27:34 +00:00
Anonymissimus
c3aa254e7d fix bug #18966 2011-11-10 21:19:10 +00:00
Anonymissimus
febb9da2ca Reverted 2011-09-21T21:44:58Z!thonsew@yahoo.com and 2011-09-20T21:21:21Z!thonsew@yahoo.com.
thonsew: The lua interface is not your playground. This is not the way
I want the lua files or its C++ interface to be modified. You are
invited to talk with me on IRC.

some of the main reasons:

-Your revisions contain lots of unneccessary changes, some of which
 break existing lua or wml without a reason. Do you ever look at the
 diffs?

-Your revisions pack a lot of unrelated stuff together into one.

2011-09-21T21:44:58Z!thonsew@yahoo.com makes sense in some parts and is what you should have
done in the first place.
2011-09-22 17:09:50 +00:00
Thonsew
70e6077f9d Fixed some of the t_token references that were leaking out into WML land.
This fixes all of the lua errors in wesnoth -t.  This does not fix all
of the errors in Anonymissimus' multiplayer add-on, which are due to
references leaking through the arbitrary code hole in wml-tags.lua:250
2011-09-21 21:44:58 +00:00
Thonsew
e59dc97260 Added support for t_token to lua code.
1. Created a t_token metatable along with support code for indexing,
garbage collection, tostring, tonumber, comparison and concatenation.

2. Adjusted string comparison and lookup in lua code to work with
either t_token or string.

This addresses in part bug #18631, bug #18695.  Before this lua was
treating all t_token as either tstrings or strings.
2011-09-20 21:21:21 +00:00
Anonymissimus
c1d8858c90 modified iterator function helper.get_sides...
...to return wesnoth.sides[side_number], side_number

TBH, I dont't fully understand the syntax, especially the one before
this, and it seems silene did experiment with it too...but this works
now at least.
2011-05-17 13:26:58 +00:00
Anonymissimus
24a8edb7bd replaced a wesnoth.get_side -> wesnoth.sides 2010-12-19 20:34:47 +00:00
Guillaume Melquiond
bd24521d56 Modified get_sides so that it returns the actual side number. Renamed it. 2010-11-07 08:22:53 +00:00
Iurii Chernyi
c30997182e standard side filter 2010-11-06 23:43:53 +00:00
Guillaume Melquiond
2992b40fca Added helper for iterating over adjacent tiles. 2010-10-31 17:24:38 +00:00
Guillaume Melquiond
406383792f Added a deprecation helper. 2010-10-03 13:30:37 +00:00
Anonymissimus
0e3b939658 Added a helper.rand function using wesnoth.set_variable(...rand=...)
...since math.rand was disabled in 2010-07-19T20:52:17Z!guillaume.melquiond@gmail.com.
2010-09-30 01:01:11 +00:00
Guillaume Melquiond
9a3728c327 Fixed usage of unqualified tovconfig.
Removed intermediate conversion to userdata since it is now up to the
caller to enable substitution.
2010-09-05 18:02:02 +00:00