Infinity?

A place for discussion of making game modifications.
Juku121
Posts: 6
Joined: Tue Mar 26, 2019 2:58 pm

Infinity?

Postby Juku121 » Fri Apr 09, 2021 5:48 am

I tried porting my old changes over to the beta (r38808) and generally mess around with the newer version of the DLC mod. Suddenly, I'm getting errors claiming "unexpected non-finite value in recorded table". Is it some kind of FP magic, and how do I debug this?

gaerzi
Posts: 177
Joined: Wed Jul 10, 2019 1:30 pm

Re: Infinity?

Postby gaerzi » Fri Apr 09, 2021 12:20 pm

I think a "non-finite value" can be either NaN or infinity. NaN seems more likely to me.

Juku121
Posts: 6
Joined: Tue Mar 26, 2019 2:58 pm

Re: Infinity?

Postby Juku121 » Fri Apr 09, 2021 12:29 pm

Edit: False alarm. I indeed had an infinity (due to dividing with 0 factories) in another part of the code. :oops:
/edit

The issue is not that I can't handle a non-numeric value. It's that I don't understand what's going on at all.

The typical example is like this:

Code: Select all

Mods\DLCSteamRules210217\Orders\tech.lua:82: unexpected non-finite value in recorded table.
Mods\DLCSteamRules210217\Orders\tech.lua:82:gain_beakers:
 Mods\DLCSteamRules210217\Orders\economy.lua:511:
  Mods\DLCSteamRules210217\@@util\functional_tricks.lua:214:
   Mods\DLCSteamRules210217\Orders\end_year.lua:106:
    Mods\DLCSteamRules210217\Orders\end_year.lua:267

Line 82:

Code: Select all

  empire.extra_science += beakers

Neither of these is really infinite, I can perform arithmetic with them just fine without triggering anything:

Code: Select all

  local xxxyyy = beakers + 1
  local xxxyyyy = empire.extra_science + 1
  xxxyyyy = xxxyyyy + xxxyyy
  empire.extra_science += beakers

The error is still on the last line.

This all looks like vanilla code to me, too. If I remove the beaker gain entirely, the error just propagates to another part of the end turn code.

gaerzi
Posts: 177
Joined: Wed Jul 10, 2019 1:30 pm

Re: Infinity?

Postby gaerzi » Fri Apr 09, 2021 7:19 pm

Juku121 wrote:If I remove the beaker gain entirely, the error just propagates to another part of the end turn code.

That's the kind of phenomenon that makes me think the real error is earlier.

But I have a lot of troubles grokking Lua. I'm just too used to C-style programming and its usually rigid types.

Juku121
Posts: 6
Joined: Tue Mar 26, 2019 2:58 pm

Re: Infinity?

Postby Juku121 » Fri Apr 09, 2021 7:55 pm

gaerzi wrote:That's the kind of phenomenon that makes me think the real error is earlier.

You're right, see the edit from earlier.

The error message just pointed me in the wrong direction, is all.

Now, if I could manage to get the tech tree lines to behave... :x


Return to “Modding”

Who is online

Users browsing this forum: No registered users and 2 guests