Some help understanding child tables

Hambil

Emperor
Joined
Oct 16, 2006
Messages
1,100
My brain is being a little slow today.

When I get a reference to a class, we'll call it pUnit, it has methods (as defined in lua wiki or in the source) that I can call such as pUnit:CanUpgradeRightNow() (and dozens of others).

I also get the data in the Units table as defined in the wiki. So I can check things like if (pUnit:PrereqResources == true). Incorrect... working on it...

However, the actual resources required are in a child table called Unit_ResourceQuantityRequirements. Accessing that child table in sql is easy enough, but I'm unclear on how I get to it via lua?

Also, and not directly related to the OP, why is this a child table? Are there units that require multiple resources to upgrade? Can such units be created via xml?
 
Still don't know why they needed a child table.
Because they are not "child tables" but are the table needed to hold "many-many relationships"

There are no standard units that require two resouces, but there are many modded ones that do. There are also many such other "many-many" tables in the game DB that have multiple entries for a unit/building/belief/civilization/leader/feature/improvement/policy/resource/trait/etc
 
Back
Top Bottom