Commit graph

9 commits

Author SHA1 Message Date
Matthias Krüger
dc33cf7ceb pofix: add fixes of previous commits. 2018-02-06 23:03:06 +11:00
Matthias Krüger
b11d3fdcbe fix a bunch of typos found by codespell in data directory.
https://github.com/lucasdemarchi/codespell
2018-02-06 23:03:06 +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
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
Chris Beck
748f872091 lua: make it easier to disable strict mode global variables
After this commit, the "strict mode" lua variable errors may be
disabled with

  ilua.strict = false

and reenabled with

  ilua.strict = true

There will typically be no noticeable performance difference from
previously to this commit.

This is a bit simpler than the other methods described which
include using pcall or resetting the metatable of _G.
2015-01-05 14:58:09 -05:00
Chris Beck
017050df70 ilua: eliminate the "_" holds last executed command feature
the ilua `_pretty_print` feature has the property that it sets _
to be what was printed, as an interpreter feature so that _
represents the results of the previous expression. However it
appears that this may conflict with some parts of our api, for
instance the _ is used to hold the return value of
wesnoth.textdomain in the lua implementation of [harm_unit].

Note that there is no actual bug that I have observed, I merely
anticipate that this _ feature won't be compatible with our
established gettext conventions.
2014-12-26 00:06:05 -05:00
Chris Beck
3740b24b28 fixup ilua _pretty_print function
had some global vs local problems after making this a module loaded
with require rather than a dofile script
2014-11-23 18:33:50 -05:00
Chris Beck
a65d168317 enable "strict mode" in wesnoth lua
Enables an ilua feature called "strict mode" in all of our lua
environments. This change causes lua to report an error if a global
variable is used before it is assigned. The benefits of this are:
- Improved maintainability of lua-based add-ons, since you get
better error reporting in case of a typo.
- Improved behavior of the lua interpreter console, since mistyped
or gibberish lines resolve to an error rather than "nil", which
the console treats as a legal return value.

It is possible to disable this or work around it in individual
scripts. For more info see release notes.
2014-11-22 15:19:19 -05:00
Chris Beck
ba4276ea31 add "ilua" helper functions for lua interpreter 2014-11-21 22:22:43 -05:00