Commit graph

83 commits

Author SHA1 Message Date
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
Guillaume Melquiond
b0d9e98fa4 Added __shallow_literal and __shallow_parsed...
...partial converters for optimizing code.  Added corresponding
helpers.
2010-07-19 06:59:46 +00:00
Guillaume Melquiond
ad61eba863 Added two helper functions parsed and literal...
...for handling uniformly WML tables and vconfig objects.
2010-07-18 21:39:06 +00:00
Nils Kneuper
0723abe7e3 add some (hackish!) attempt to make the po update routines scan .lua files...
...for strings, too

this is done by a) scanning for all .lua files additionally to all
.cfg files in FINDCFG and b) by adding the equivalent of a "commented
out" #textdomain DOMAIN declaration

next step: testing if it really does work as expected this should also
fix bug #15629 since the objectives are now *only* declared via some
lua magic
2010-03-15 20:22:28 +00:00
Guillaume Melquiond
e7bd6d3440 Added helper for tile distance. 2010-02-20 11:17:28 +00:00
Guillaume Melquiond
0ae86b9018 Improved helpers a bit. 2010-01-31 19:08:18 +00:00
Guillaume Melquiond
a41e13ddfd Added a few more Lua helpers. 2009-12-24 13:59:18 +00:00
Guillaume Melquiond
29d9afb566 Removed package emulation. 2009-09-27 11:44:28 +00:00
Guillaume Melquiond
748c9dc883 Made some helper functions part of the interface. 2009-09-27 11:44:16 +00:00
Guillaume Melquiond
8a20afcc2f Added Lua helper file. 2009-03-22 19:00:01 +00:00