GameInfo queries

Thalassicus

Bytes and Nibblers
Joined
Nov 9, 2005
Messages
11,057
Location
Texas
for row in GameInfo.Unit_ClassUpgrades{UnitType = thisUnit.Type} do

I recently learned about the capability to pass tables to GameInfo instead of strings. How do I represent these strings in table format:

local query = string.format("ObsoleteTech = '%s' AND BarbUpgradeType IS NOT NULL", techInfo.Type)
for unitInfo in GameInfo.Units(query) do

local query = string.format("BuildingClass = '%s' OR FreeBuildingThisCity = '%s'", buildingClass, buildingClass)
for buildingInfo in GameInfo.Buildings(query) do
 
Thanks for the link! Is the null one...

GameInfo.Units{ObsoleteTech = techInfo.Type, BarbUpgradeType}

I couldn't find any examples of is/isnot null references in the game files or mods I've downloaded.
 
Is the null one...

GameInfo.Units{ObsoleteTech = techInfo.Type, BarbUpgradeType}

Very much doubt it as

Code:
test = {this="that", other};

print(test.this);
print(test.other);

produces

Code:
>lua -e "io.stdout:setvbuf 'no'" "test.lua" 
that
nil
>Exit code: 0

and I'm guessing the nil value will "blow up" the resulting query (if not before)

Start up FireTuner, try it and let us know ;)
 
Is it possible to represent "not equal" in this table form? These did not work:

for policyInfo in GameInfo.Policies{HappinessToScience ~= 0} do
for policyInfo in GameInfo.Policies{HappinessToScience != 0} do
for policyInfo in GameInfo.Policies{HappinessToScience <> 0} do

Edit: nevermind, I realize I was thinking about this the wrong way. I recognized this just sets variables in a sparse table, then the GameInfo function passes those key/value pairs to sql. So to add to what whoward said... the only thing that can be done is and'ing together "=" checks.
 
Back
Top Bottom