Currently Online

Latest Posts

Topic: How can I use my debug.script in lua console from addon?

MarkMcWire
Avatar
Joined: 2017-02-08, 21:06
Posts: 294
Ranking
Tribe Member
Location: Eisenach, Germany
Posted at: 2021-07-30, 17:36

If I try:

dofile("addons/enhanced_debug_scripts.wad/debug.lua")


or

dofile("/addons/enhanced_debug_scripts.wad/debug.lua")


or

dofile("../addons/enhanced_debug_scripts.wad/debug.lua")


the console couldn't find my script file.

What is the correct syntax?

My widelands project: https://github.com/widelands/wl_addons_server/tree/master/addons/europeans_tribe.wad

Top Quote
MarkMcWire
Avatar
Joined: 2017-02-08, 21:06
Posts: 294
Ranking
Tribe Member
Location: Eisenach, Germany
Posted at: 2021-07-30, 17:40

BTW:

 include "addons/enhanced_debug_scripts.wad/debug.lua" 


seems to work.

My widelands project: https://github.com/widelands/wl_addons_server/tree/master/addons/europeans_tribe.wad

Top Quote
Nordfriese
Avatar
Joined: 2017-01-17, 18:07
Posts: 1454
Ranking
One Elder of Players
Location: 0x55555d3a34c0
Posted at: 2021-07-30, 17:47

include is the one you should use preferably because it resolves filepaths relative to the home directory, data directory, or map as appropriate. dofile is a Lua built-in function which can be used for any file on your system; it requires the absolute path to the file or a path relative to the current working directory.


Top Quote