Latest Posts

Topic: lua_errors.cc:22 Error

MarkMcWire
Avatar
Topic Opener
Joined: 2017-02-08, 21:06
Posts: 321
Ranking
Tribe Member
Location: Eisenach, Germany
Posted at: 2017-08-31, 07:51

I have made a new tribe for Widelands. In essence, this is a copy of the empire with some buildings and workers from atlanteans and barbarians, too. I have created new folders in all areas (buildings, workers, scripting). Since I made this modifications I always get the following error:

[QUOTE] This is Widelands Version build-19 (Release) Set home directory: /home/linuxmint18/.widelands Adding directory: /usr/share/games/widelands/data selected language: (system language) using locale de_DE.UTF-8 Graphics: Try to set Videomode 800x600 Graphics: OpenGL: Version "3.0 Mesa 17.0.7" Graphics: SDL_GL_RED_SIZE is 8 Graphics: SDL_GL_GREEN_SIZE is 8 Graphics: SDL_GL_BLUE_SIZE is 8 Graphics: SDL_GL_ALPHA_SIZE is 0 Graphics: SDL_GL_BUFFER_SIZE is 24 Graphics: SDL_GL_DOUBLEBUFFER is 1 Graphics: SDL_GL_DEPTH_SIZE is 24 Graphics: SDL_GL_STENCIL_SIZE is 0 Graphics: SDL_GL_ACCUM_RED_SIZE is 0 Graphics: SDL_GL_ACCUM_GREEN_SIZE is 0 Graphics: SDL_GL_ACCUM_BLUE_SIZE is 0 Graphics: SDL_GL_ACCUM_ALPHA_SIZE is 0 Graphics: SDL_GL_STEREO is 0 Graphics: SDL_GL_MULTISAMPLEBUFFERS is 0 Graphics: SDL_GL_MULTISAMPLESAMPLES is 0 Graphics: SDL_GL_ACCELERATED_VISUAL is 1 Graphics: SDL_GL_CONTEXT_MAJOR_VERSION is 2 Graphics: SDL_GL_CONTEXT_MINOR_VERSION is 1 Graphics: SDL_GL_CONTEXT_FLAGS is 0 Graphics: SDL_GL_CONTEXT_PROFILE_MASK is 2 Graphics: SDL_GL_SHARE_WITH_CURRENT_CONTEXT is 0 Graphics: SDL_GL_FRAMEBUFFER_SRGB_CAPABLE is 0 Graphics: OpenGL: Double buffering enabled Graphics: OpenGL: Max texture size: 16384 Graphics: OpenGL: ShadingLanguage: "1.30" * GRAPHICS REPORT VIDEO DRIVER x11 pixel fmt 370546692 size 800 600 * END GRAPHICS REPORT lastserial: 0 There's no configuration file, using default values. Loading the world took 243ms Loading Ships Loading Wares Loading Immovables Loading Workers Loading Warehouses Loading Productionsites Loading Trainingsites Loading Militarysites Loading Partially Finished Buildings Loading Atlanteans Loading Barbarians Loading Empire Loading Europeans Finished loading tribes Loading the tribes took 545ms Reading Elemental Data ... took 0ms Reading Player Names And Tribe Data ... took 0ms Reading Port Spaces Data ... took 0ms Reading Heights Data ... took 0ms Reading Terrain Data ... took 0ms Reading Map Objects ... took 4ms Reading Player Start Position Data ... took 0ms Reading Resources Data ... took 1ms Reading Map Version Data ... took 0ms Reading Allowed Worker Types Data ... took 0ms Reading Allowed Building Types Data ... took 0ms Reading Node Ownership Data ... took 0ms Reading Exploration Data ... took 0ms Reading Flag Data ... took 0ms Reading Road Data ... took 0ms Reading Building Data ... took 0ms Reading Flagdata Data ... took 0ms Reading Roaddata Data ... took 0ms Reading Buildingdata Data ... took 0ms Second and third phase loading Map Objects ... took 0ms Reading Players View Data ... took 0ms Reading Player Message Data ... took 0ms Reading Objective Data ... took 0ms Reading Scripting Data ... took 0ms Reading map images ... took 0ms WidelandsMapLoader::load_map_complete() for 'The Pass Through the Mountains' took 7ms Starting replay writer Game: Writing Preload Data ... took 0ms Game: Writing Game Class Data ... took 0ms Game: Writing Player Info ... took 0ms Game: Writing Map Data! Writing Elemental Data ... took 0ms Writing Player Names And Tribe Data ... took 0ms Writing Port Spaces Data ... took 0ms Writing Heights Data ... took 0ms Writing Terrain Data ... took 1ms Writing Player Start Position Data ... took 0ms Writing Player Message Data ... took 0ms Writing Resources Data ... took 1ms Writing Map Version ... took 0ms Writing Allowed Worker Types Data ... took 0ms Writing Allowed Building Types Data ... took 2ms Writing Flag Data ... took 0ms Writing Road Data ... took 0ms Writing Building Data ... took 0ms Writing Map Objects ... took 7ms Writing Node Ownership Data ... took 0ms Writing Exploration Data ... took 0ms Writing Players Unseen Data ... took 1ms Writing Scripting Data ... took 21ms Writing Objective Data ... took 0ms Writing map images ... took 0ms MapSaver::save() for 'The Pass Through the Mountains' took 35ms Game: Writing Map Data took 36ms Game: Writing Player Economies Info ... took 0ms Game: Writing ai persistent data ... took 0ms Game: Writing Command Queue Data ... took 6ms Game: Writing Interactive Player Data ... took 0ms GameSaver::save() took 42ms SaveHandler::save_game() took 42ms Reloading the game from replay Game: Reading Preload Data ... took 0ms Game: Reading Game Class Data ... took 0ms Game: Reading Map Data ... Game: Reading Map Data took 1ms Game: Reading Player Info ... Game: Reading Player Info took 0ms Game: Calling read_complete() Reading Elemental Data ... took 0ms Reading Player Names And Tribe Data ... took 1ms Reading Port Spaces Data ... took 0ms Reading Heights Data ... took 0ms Reading Terrain Data ... took 0ms Reading Map Objects ... took 5ms Reading Player Start Position Data ... took 0ms Reading Resources Data ... took 1ms Reading Map Version Data ... took 0ms Reading Allowed Worker Types Data ... took 0ms Reading Allowed Building Types Data ... took 0ms Reading Node Ownership Data ... took 0ms Reading Exploration Data ... took 1ms Reading Flag Data ... took 0ms Reading Road Data ... took 0ms Reading Building Data ... took 0ms Reading Flagdata Data ... took 0ms Reading Roaddata Data ... took 0ms Reading Buildingdata Data ... took 1ms Second and third phase loading Map Objects ... took 0ms Reading Players View Data ... Vision check successful for player 1 Vision check successful for player 2 took 6ms Reading Player Message Data ... took 0ms Reading Objective Data ... took 1ms Reading Scripting Data ... took 2ms Reading map images ... took 0ms WidelandsMapLoader::load_map_complete() for 'The Pass Through the Mountains' took 21ms Game: read_complete took: 21ms Game: Reading Player Economies Info ... took 0ms Game: Reading ai persistent data ... took 0ms Game: Reading Command Queue Data ... took 1ms Game: Parsing messages ... took 0ms Game: Reading Interactive Player Data ... took 0ms GameLoader::load() took 23ms Done reloading the game from replay Replay writer has started [sync] Reset ComputerPlayer(2): initializing as type 2 Forcing flag at (21, 32) Message: adding warehouse for player 1 at (20, 31) Forcing flag at (4, 16) Message: adding warehouse for player 2 at (3, 15) Error in Lua Coroutine [/build/widelands-yyMMCF/widelands-19-1/src/scripting/lua_errors.cc:22] attempt to index a nil value Send message to all players and pause gameFatal exception: [/build/widelands-yyMMCF/widelands-19-1/src/scripting/lua_errors.cc:22] attempt to index a nil value Game: Writing Preload Data ... Speicherzugriffsfehler [/QUOTE]

I use Build 19 with Linux Mint 18.1. The error occurs regardless of which tribe is used.

How can I fix this?

Edited: 2017-08-31, 07:53

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

Top Quote
kaputtnik
Avatar
Joined: 2013-02-18, 20:48
Posts: 2433
OS: Archlinux
Version: current master
Ranking
One Elder of Players
Location: Germany
Posted at: 2017-08-31, 08:30

" attempt to index a nil value" is mostly triggered if a variable has no value, or the variable is missing/misspelled, afaik.

Unfortunately the errormessage does not show where the crash happens. I would guess somewhere in warehouses.

Did you create the new tribe in /usr/share/games/widelands/data? If yes you shouldn't do that, instead copy the data folder into your home directory and run widelands with the option --datadir:

widelands --datadir=/home/your_name/path/to/widelands/data/

Doing so the original files and folders are not tainted and a comparison from original to modified is much easier.


Fight simulator for Widelands:
https://wide-fighter.netlify.app/

Top Quote
MarkMcWire
Avatar
Topic Opener
Joined: 2017-02-08, 21:06
Posts: 321
Ranking
Tribe Member
Location: Eisenach, Germany
Posted at: 2017-08-31, 09:04

kaputtnik wrote:

" attempt to index a nil value" is mostly triggered if a variable has no value, or the variable is missing/misspelled, afaik.

Unfortunately the errormessage does not show where the crash happens. I would guess somewhere in warehouses.

Is there as possibility to debug the game?

Did you create the new tribe in /usr/share/games/widelands/data?

No, I used the .widelands folder in my home directory.

Doing so the original files and folders are not tainted and a comparison from original to modified is much easier.


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

Top Quote
MarkMcWire
Avatar
Topic Opener
Joined: 2017-02-08, 21:06
Posts: 321
Ranking
Tribe Member
Location: Eisenach, Germany
Posted at: 2017-08-31, 09:07

kaputtnik wrote:

" attempt to index a nil value" is mostly triggered if a variable has no value, or the variable is missing/misspelled, afaik.

widelands --datadir=/home/linuxmint18/.widelands This is Widelands Version build-19 (Release) Set home directory: /home/linuxmint18/.widelands Adding directory: /home/linuxmint18/.widelands selected language: (system language) using locale de_DE.UTF-8

Caught exception (of type '25LuaScriptNotExistingError') in outermost handler! The exception said: [/build/widelands-yyMMCF/widelands-19-1/src/scripting/lua_errors.cc:22] The script 'i18n/fonts.lua' was not found!

This should not happen. Please file a bug report on version build-19(Release). and remember to specify your operating system.


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

Top Quote
MarkMcWire
Avatar
Topic Opener
Joined: 2017-02-08, 21:06
Posts: 321
Ranking
Tribe Member
Location: Eisenach, Germany
Posted at: 2017-08-31, 11:43

Game: Writing Preload Data ... Thread 1 "widelands" received signal SIGSEGV, Segmentation fault. 0x00000000008f6b9a in Widelands::GamePreloadPacket::write(FileSystem&, Widelands::Game&, Widelands::MapObjectSaver*) () (gdb)


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: 1928
OS: Debian Testing
Version: Latest master
Ranking
One Elder of Players
Location: 0x55555d3a34c0
Posted at: 2017-08-31, 14:31

Since "attempt to index a nil value" is triggered after warehouses are added, it is probably related to scripting. Perhaps you used the Collectors win condition, it needs tweaking to work with a custom tribe.

You should not create a tribe in any directory other than a widelands data directory. Copy-paste the /usr/share/games/widelands/data to your home folder (e.g. ~/widelands-custom/data) and create the tribe in ~/widelands-custom/data/tribes. Run with --datadir=~/widelands-custom/data. If you do not do this, it is likely to result in lots of errors, including the "i18n/fonts.lua not found". And having an error in any lua files means that no game can be started, even if your custom tribe is not used.

I´d also advise you to get a recent development build, as b19 will crash as soon as an AI sees an enemy with unknown tribe. Compiling widelands as debug and running it in a debugger like gdb sometimes provides useful information in crashes, but if they´re related to lua, this is usually not the case. When reporting a crash or other error, please include information what exactly you did when the game crashed.


Top Quote
MarkMcWire
Avatar
Topic Opener
Joined: 2017-02-08, 21:06
Posts: 321
Ranking
Tribe Member
Location: Eisenach, Germany
Posted at: 2017-08-31, 21:01

Nordfriese wrote:

Since "attempt to index a nil value" is triggered after warehouses are added, it is probably related to scripting. Perhaps you used the Collectors win condition, it needs tweaking to work with a custom tribe.

You should not create a tribe in any directory other than a widelands data directory. Copy-paste the /usr/share/games/widelands/data to your home folder (e.g. ~/widelands-custom/data) and create the tribe in ~/widelands-custom/data/tribes. Run with --datadir=~/widelands-custom/data. If you do not do this, it is likely to result in lots of errors, including the "i18n/fonts.lua not found". And having an error in any lua files means that no game can be started, even if your custom tribe is not used.

Ok. I thought entries in .widelands automatically overwrite existing data. In the previous version, that was synonymous.

I´d also advise you to get a recent development build, as b19 will crash as soon as an AI sees an enemy with unknown tribe. Compiling widelands as debug and running it in a debugger like gdb sometimes provides useful information in crashes, but if they´re related to lua, this is usually not the case. When reporting a crash or other error, please include information what exactly you did when the game crashed.

I'll do it in the future. I am currently working on improving the economy. That is why I used a copy of the empire under the title "Europeans". I have a few suggestions for improvement, but I want to test it before. Then I modify the empire first directly.


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

Top Quote
GunChleoc
Avatar
Joined: 2013-10-07, 15:56
Posts: 3324
Ranking
One Elder of Players
Location: RenderedRect
Posted at: 2017-09-02, 15:19

Is this really practical? You will have to rename the internal names of all workers, buildings etc and then rename them back when you're done.

Better fetch a branch and do your work in there, using the --datadir option. This way, comparison with Widelands trunk and merging your work later will be much easier.

Also, I agree on getting a development build, there were some changes to the tribes since Build 19, e.g. a Barracks building was added. If you want to work on balancing, Build19 will already be outdated.


Busy indexing nil values

Top Quote