Donation

Help us to pay our server!
(: Consider a donation :)



Social Media

  • Facebook
  • Google+

Latest Posts

Topic: Scenarios: File I/O

GunChleoc
Avatar
Joined: 2013-10-07, 15:56
Posts: 2398
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());
}

Top Quote
Nordfriese
Avatar
Joined: 2017-01-17, 18:07
Posts: 223
Ranking
Widelands-Forum-Junkie
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