[BNW] [SOLVE]Change SQL values with LUA

Cat-du-fromage

Warlord
Joined
Nov 17, 2018
Messages
189
Hello,

With a friend, we are stuck trying to change a SQL values with a LUA functions,

We made an ALTER TABLE Civilization_CityNames to add Connected column:
upload_2019-2-16_18-16-56.png


The GOAL is to changed the "0 "to "1" (Last Test code)
upload_2019-2-16_18-32-16.png

But The data base said it didn't works
upload_2019-2-16_18-27-17.png

Player:changeGold(900) and strangly we got 3x 900 gold doing so...
upload_2019-2-16_18-24-42.png

We searched everywhere but nothing workes.

Did we use the good function(query)?

Is it even possible to change the SQL with LUA?

Hope someone has the solution^^ we will owe him ONE!
 

Attachments

  • upload_2019-2-16_18-20-40.png
    upload_2019-2-16_18-20-40.png
    5.7 KB · Views: 117
  • upload_2019-2-16_18-32-7.png
    upload_2019-2-16_18-32-7.png
    16.6 KB · Views: 147
Last edited:
Can't be done. Once the game database (the one your SQL alters) is read at startup it's effectively read-only. The database that OpenSaveData access is not the game database.
 
Assuming you want to store data, you can use TableSaverLoader or SaveUtils to store information across a single playthrough. (I.e. your stored information persist after loading a saved game).
Though it seems unlikely judging from your code, if you need to store across all games (I.e. your stored information persists from one game to another) then you can use the ModUserData.

oh... so we definitly can't change values in SQL using LUA.. sad
The exception being the Localisation-tables (I.e. the ones that store the language keys) by using some tricks, and the ModUserData-tables.
(Then again those are technically not part of the game database.)
 
Top Bottom