Latest Posts

Topic: Scenarios: File I/O

GunChleoc
Avatar
Joined: 2013-10-07, 15:56
Posts: 3324
Ranking
One Elder of Players
Location: RenderedRect
Posted at: 2018-05-06, 07:30

You probably need something like this to prevent nil values:

if (lua_isnil(L, -1)) {
    report_error(L, "Trying to save a nil value for %s to campaign data!", <key_info>.c_str());
}

Busy indexing nil values

Top Quote
Nordfriese
Avatar
Topic Opener
Joined: 2017-01-17, 18:07
Posts: 1929
OS: Debian Testing
Version: Latest master
Ranking
One Elder of Players
Location: 0x55555d3a34c0
Posted at: 2018-05-17, 10:09

I got nowhere trying to check for nil values directly, but instead found a way to check this indirectly by comparing the array index to the iterating index. If they are unequal, it means that a nil value was silently skipped, so a coroutine error is thrown.


Top Quote