Important Dates

Currently Online

Latest Posts

Topic: Scenarios: File I/O

Joined: 2013-10-07, 15:56
Posts: 3159
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
Joined: 2017-01-17, 18:07
Posts: 701
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