Odd infolog parse errors but no issues ingame

Odd infolog parse errors but no issues ingame

Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)

Moderator: Moderators

Post Reply
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Odd infolog parse errors but no issues ingame

Post by Forboding Angel »

There isn't any easy way to explain this, but I'll try.

In order to facilitate multiple upgrade levels, I am building a system where I have base unitdefs as configs (basedefs), and the unitdefs (Ignore the unused folder... those are old units no longer used) themselves call the configs. The way that I can change various unit tags is via a normalized static variable that I put in the base def.

For example, here is a list of some of the static variables I use in the basedef:

Code: Select all

unitName                   = "eheavytank3"

isUpgraded	= false
isUpgraded2	= false
isUpgraded3	= false

humanName = "Crusher"

objectName = "eheavytank4.s3o"
script = "eheavytank4_lus.lua"

tech = [[tech2]]
armortype = [[armored]]
supply = [[4]]
These variables are declared in the actual unitdef before the include. This way, in the unitdef I can change values in the basedef.

Unitname is obvious enough. isUpgraded is used in both unit and weapon basedef customparams. It triggers alterations to some stats in POST (search for isUpgraded in alldefs_post). This way, I can quickly and mathematically alter stats of upgrade units without actually changing any unitdef values by hand.

Humanname, also obvious as are object and script.

Tech, armortype and supply are all unit customparams values.

******************

Ok, so I've established what I'm doing.

It gets a little more complicated when you factor in factories and their upgraded counterparts, because you have to change buildlists. The way I have gotten around that is to use unitdefs_pre to define the buildlists. I then define a static variable in the factory basedef, and in the unitdef I change the static variable value to match whatever buildlist that factory should be using.

*******************

Everything works perfectly!

As in, nothing is broken, upgrades are applied, literally everything works. But then I have this in infolog:

Code: Select all

[f=-000001] Loading GameData Definitions
[f=-000001] [unitdefs.lua] Error: Error parsing units/ehover/basedefs/eartytank_basedef.lua: error = 2, units/ehover/basedefs/eartytank_basedef.lua, [string "units/ehover/basedefs/eartytank_basedef.lua"]:16: attempt to concatenate global 'supply' (a nil value)

[f=-000001] [unitdefs.lua] Error: Bad return table from: units/ehover/basedefs/ebasefactory_basedef.lua
[f=-000001] [unitdefs.lua] Error: Error parsing units/ehover/basedefs/eheavytank3_basedef.lua: error = 2, units/ehover/basedefs/eheavytank3_basedef.lua, [string "units/ehover/basedefs/eheavytank3_basedef.l..."]:16: attempt to concatenate global 'supply' (a nil value)

[f=-000001] [unitdefs.lua] Error: Error parsing units/ehover/basedefs/elacerator_basedef.lua: error = 2, units/ehover/basedefs/elacerator_basedef.lua, [string "units/ehover/basedefs/elacerator_basedef.lu..."]:17: attempt to concatenate global 'supply' (a nil value)

[f=-000001] [unitdefs.lua] Error: Error parsing units/ehover/basedefs/elighttank3_basedef.lua: error = 2, units/ehover/basedefs/elighttank3_basedef.lua, [string "units/ehover/basedefs/elighttank3_basedef.l..."]:16: attempt to concatenate global 'supply' (a nil value)

[f=-000001] [unitdefs.lua] Error: Error parsing units/ehover/basedefs/emissiletank_basedef.lua: error = 2, units/ehover/basedefs/emissiletank_basedef.lua, [string "units/ehover/basedefs/emissiletank_basedef...."]:17: attempt to concatenate global 'supply' (a nil value)

[f=-000001] [unitdefs.lua] Error: Error parsing units/ehover/basedefs/eriottank2_basedef.lua: error = 2, units/ehover/basedefs/eriottank2_basedef.lua, [string "units/ehover/basedefs/eriottank2_basedef.lu..."]:16: attempt to concatenate global 'supply' (a nil value)

[f=-000001] [Gameplay Speed] Set to normal
[f=-000001] [defs.lua] loading all *Defs tables: 692ms
[f=-000001] Game::LoadDefs (GameData): 746 ms
What it is complaining about is that I use the supply variable to concat in description of the unit showing how much supply a unit uses. Also, it should be noted that that is the first time an outside variable is used in the basedef.

It should be noticed that there is a bad return table from the factory basedef. That sounds fairly serious, until you consider that it's working as intended. But obviously something is screwy here, and I would like to know what.

That said, I am having a lot of trouble tracking it down. Could some enterprising soul give me a hand?

Like I said, functionally, it is working correctly. Here is a screenshot containing all of the units using the above outlined methods:

Image

I need fresh eyes, cause I'm at a total loss. I think that the bad return table has something to do with it, but it's so unspecific that I don't know how to diagnose.
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Odd infolog parse errors but no issues ingame

Post by Forboding Angel »

Simple and understandable mistake. I have been working long hours and have been doing this while exhausted. It didn't occur to me that the engine doesn't know configs from units when a file is in the units folder.

Super silly mistake. Thanks to gajop for jogging my exhausted brain.
Post Reply

Return to “Lua Scripts”