Commit graph

9 commits

Author SHA1 Message Date
gfgtdf
8a33ad0bf1 fix #4256 wesnoth.require with relative paths
now wesnoth.require is able to detect when the same file is
required two times using different names (like a/../a/b.lua
a/b.lua) and will only execute it once.

for this a new function wesnoth.canonical_path was added
2019-08-24 18:52:14 +02:00
Celtic Minstrel
37f1c490a5 Lua: Use the second argument to error() where appropriate 2017-05-10 17:40:13 -04:00
Celtic Minstrel
cbba6b3929 wesnoth.require: Automatically check current directory for packages 2017-05-07 18:54:16 -04:00
Celtic Minstrel
b6ddbd8df2 wesnoth.require: Only log error and return nil on failure 2017-05-05 15:16:10 -04:00
Celtic Minstrel
b045760cd5 Prevent people from altering the special "empty package" value,
which is stored in wesnoth.package to prevent reloading loaded
packages just because they didn't return anything.

There's a special exception for accessing __tostring because ilua needs it.
2017-05-05 13:08:54 -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
Celtic Minstrel
690acf9b79 Allow wesnoth.require to load a whole directory in one call
- Use this feature when loading the WML tags from data/lua/wml
2017-05-03 02:43:13 -04:00
Celtic Minstrel
6b74f91b2f Allow shorter module name specification in wesnoth.require
Basically, you can now omit the "lua/" prefix and the ".lua" suffix.
If necessary, they will automatically be applied for you.
2017-05-03 02:42:17 -04:00
Celtic Minstrel
072ddc4dc1 Reimplement wesnoth.require function in Lua 2017-05-03 02:40:34 -04:00