Lua problems

Skaz881

History Major
Joined
Dec 15, 2013
Messages
1,368
Location
Crystal Lake, Illinois, USA.
In order to have a balanced game, I added the resources from my pack to Barathor's pack. But when I launch a game, the map is completely hidden, it's on the barbarian's turn and I get the "you have been defeated message". What did I miss in the Lua code? (My Lua log is in the More Luxuries thread, it won't let me upload it here as well).
 

AW Arcaeca

Deus Vult
Joined
Mar 10, 2013
Messages
2,977
Location
Operation Padlock ground zero
:dubious: Dang that's a lotta errors...

Let's break this down:
You have a lot of syntax errors that follow this pattern:
Code:
Syntax Error: C:\Users\Sarah\Documents\My Games\Sid Meier's Civilization 5\MODS\More Luxuries (v 152)\Lua\AssignStartingPlots.lua:761: '}' expected near '10'
Meaning on line 761 you forgot an end curly bracket somewhere.

Then there a runtime errors, which I'm guessing probably results from the syntax errors, but that's guesswork. Did you attach the actual lua files anywhere with your changes?
 

Skaz881

History Major
Joined
Dec 15, 2013
Messages
1,368
Location
Crystal Lake, Illinois, USA.
I attached the Lua file that I changed to the opening of this thread.
 

AW Arcaeca

Deus Vult
Joined
Mar 10, 2013
Messages
2,977
Location
Operation Padlock ground zero
Ah. You weren't missing a curly bracket, but there is something else wrong with that line...
Let's compare it with the line above which works totally fine:
Line 760 (Functional) Line 761 (Malfunctional)
Code:
	[COLOR="Green"]{self.emeraldz_ID,  10},[/COLOR]
	[COLOR="Red"]{self.sapphirez_ID  10},[/COLOR]
Spot the difference!
 

Skaz881

History Major
Joined
Dec 15, 2013
Messages
1,368
Location
Crystal Lake, Illinois, USA.
Thank you, I have it working now!
 

bane_

Howardianism High-Priest
Joined
Nov 27, 2013
Messages
1,559
Ah. You weren't missing a curly bracket, but there is something else wrong with that line...
Let's compare it with the line above which works totally fine:
Line 760 (Functional) Line 761 (Malfunctional)
Code:
	[COLOR="Green"]{self.emeraldz_ID,  10},[/COLOR]
	[COLOR="Red"]{self.sapphirez_ID  10},[/COLOR]
Spot the difference!

The comma! The comma!
What do I get, Mr. AW? :dance:
 

AW Arcaeca

Deus Vult
Joined
Mar 10, 2013
Messages
2,977
Location
Operation Padlock ground zero
The comma! The comma!
What do I get, Mr. AW? :dance:
Life experience :cooool:
*class groans because that's the least desirable reward*
 

Skaz881

History Major
Joined
Dec 15, 2013
Messages
1,368
Location
Crystal Lake, Illinois, USA.
I spoke too soon, now I'm getting this error!
Code:
Runtime Error: C:\Users\Sarah\Documents\My Games\Sid Meier's Civilization 5\MODS\More Luxuries (v 152)\Lua\AssignStartingPlots.lua:8448: attempt to compare nil with number
stack traceback:
 

Skaz881

History Major
Joined
Dec 15, 2013
Messages
1,368
Location
Crystal Lake, Illinois, USA.
So it seems I was wrong about my problems being over, because no sooner did I solve one problem than another one appeared. Now no resources are spawning and I'm getting this error:
Code:
Runtime Error: C:\Users\Sarah\Documents\My Games\Sid Meier's Civilization 5\MODS\More Luxuries (v 152)\Lua\AssignStartingPlots.lua:8448: attempt to compare nil with number
stack traceback:
	C:\Users\Sarah\Documents\My Games\Sid Meier's Civilization 5\MODS\More Luxuries (v 152)\Lua\AssignStartingPlots.lua:8448: in function 'AssignLuxuryToRegion'
	C:\Users\Sarah\Documents\My Games\Sid Meier's Civilization 5\MODS\More Luxuries (v 152)\Lua\AssignStartingPlots.lua:8657: in function 'AssignLuxuryRoles'
	C:\Users\Sarah\Documents\My Games\Sid Meier's Civilization 5\MODS\More Luxuries (v 152)\Lua\AssignStartingPlots.lua:11436: in function 'PlaceResourcesAndCityStates'
	Assets\DLC\DLC_SP_Maps\Maps\PangaeaPlus.lua:1340: in function 'StartPlotSystem'
	Assets\DLC\Expansion2\Gameplay\Lua\MapGenerator.lua:815: in function <Assets\DLC\Expansion2\Gameplay\Lua\MapGenerator.lua:779>
	=[C]: ?

The More Luxuries thread has my attachments.
 

Bobert13

Prince
Joined
Feb 25, 2013
Messages
346
You attempted to "compare nil with number" on line 779 of MapGenerator.lua (It may actually be at line 8448 of ASP.lua; I can't recall :lol:). This usually happens when you have a variable that has a chance to not become initialized. When the function that compares said variable gets called and the variable wasn't initialized it throws this error. Either your variable isn't working as intended, or it is working as intended, but you forgot to check that it was initialized (myVar ~= nil) before comparing it.
 

Rob (R8XFT)

Ancient Briton
Retired Moderator
Joined
Aug 11, 2002
Messages
10,871
Location
Leeds (UK)
Moderator Action: Merged the two threads about the lua errors that Skaz881 is experiencing; it's more beneficial to have them together so that others can see the history of the issue (it could be, for example, that what was suggested as a fix for issue #1 also causes issue #2).
Please read the forum rules: http://forums.civfanatics.com/showthread.php?t=422889
 

Skaz881

History Major
Joined
Dec 15, 2013
Messages
1,368
Location
Crystal Lake, Illinois, USA.
Which just leaves me very confused because at line 8448 there is this code
Code:
if self.luxury_assignment_count[res_ID] < split_cap then -- This type still eligible.
 

Bobert13

Prince
Joined
Feb 25, 2013
Messages
346
Is "res_ID" getting set by a for loop? If so, then the loop is exceeding the number of indexes stored in that table causing the nil value.
 

Skaz881

History Major
Joined
Dec 15, 2013
Messages
1,368
Location
Crystal Lake, Illinois, USA.
Actually it turns out that the problem was being caused by a typo:blush:.
 
Top Bottom