[Wiki] New Lua and UI Reference! Beta version

but the log was empty while I knew thanks to IGE's output that this mod had references problems.

Which would have been the same if the "buggy code" had been written in SQL.

XML either parses or it doesn't (much like SQL) (those errors end up in xml.log) and it either executes or it doesn't (exactly like SQL) (those end up in database.log) - once your problem is neither of those it really doesn't matter if you wrote the "buggy code" in SQL or XML as you're into the realms of understanding the (weak) relationships within the database - was the correct Type name used, was a Type used when a Class was required, etc
 
Thank you for the clarification. In my example, the problem was that a foreign key did not correspond to any primary key in the target table. Form what you say, it should have appeared in database.log since it was an integrity constrain violation. Do you think I just did read the wrong log or something like this?
 
it should have appeared in database.log since it was an integrity constrain violation.

AFAIK there are no constraints in the Civ5 database (at least not as any SQL programmer would understand the term). The only ones that are checked (by code in the DLL) are for TXT_KEY_ entries

attachment.php
 
AFAIK there are no constraints in the Civ5 database (at least not as any SQL programmer would understand the term). The only ones that are checked (by code in the DLL) are for TXT_KEY_ entries
:eek:
Wow! I certainly wasn't expecting that. So we have no automated way to detect foreign keys problems? (aside of looking at IGE's output for some tables).

Now, regarding SQLiteSPy, is it another snapshot viewer like SQLite Manager and SQLite Browser or does it do something more?
 
SQLiteSpy is another db browser - probably for those old people that remember Toad for Oracle ;)
 
A bit more digging

Constraints have to be enabled - see Section 2 of http://www.sqlite.org/foreignkeys.html

and it seems the core does enable them, but that gives even stranger results

Code:
</GameData>
<Building_FreeUnits>
 <Row>
  <BuildingType>BUILDING_WHOWARD<BuildingType>
  <UnitType>UNIT_DONQUICHE</UnitType>
  <NumUnits>1</NumUnits>
 </Row>
</Building_FreeUnits>
</GameData>

First, an error in database.log

Code:
[9533.876] Invalid Reference on Building_FreeUnits.BuildingType - "BUILDING_WHOWARD" does not exist in Buildings

but also a partial entry in the database

attachment.php


Which is about as useful as a chocolate teapot!
 
You frightened me for a moment. I am glad to learn that those things are checked too. I guess I was blind the day I looked at those logs or something like this. ^^

Now I do not see anything strange with the error reported by civ5: with it you can just search the faulty type and find where the cluprit lies.
 
On your Persistent Data section, you might include a link to my TableSaverLoader component here. It's not the most elegant code (I'm a professional who uses programming, not a professional programmer) but it has the benefit of actually existing and it seems to be bug free. (I'd be overjoyed if one of you all wrote something better, but until then...)
 
On your Persistent Data section, you might include a link to my TableSaverLoader component here. It's not the most elegant code (I'm a professional who uses programming, not a professional programmer) but it has the benefit of actually existing and it seems to be bug free. (I'd be overjoyed if one of you all wrote something better, but until then...)
This is the wrong post but, yeah, I just added it. ;)
I also created a Lua Libraries for Civ5 page.
 
News of the day:
* Some pages are just blank, this is because of a php bug, still because of the syntax coloring (damn!). Will be fixed soon(tm).
* Persisting data
* Lua libraries for Civ5
* The VFS
* Text icons and markups

PS: Do not hesitate to report problems, bugs and typos (in the automatically generated pages) or to fix them (in the manually written pages) if you encounter any of those. Critics and suggestions are welcome too.
 
News of the day:
* The syntax coloring is now working properly. \o/ If you still see a page with the wrong coloring, you can edit it to do any change(add or remove one whitespace) and force a refresh. All pages will be refreshed at the end of the beta period of before.
* Debugging (Civ5) is now complete.
* Lua introduction for confirmed developers now has a section on coroutines.
 
I noticed something interesting: on this page, it says:

This is a static method, invoke it with a dot.

But in the "Source code samples" it's always invoked with a colon. So which is the proper method of invoking it?
 
Hello Pawels. :)

Using a dot is the proper way for this method. Obviously, one of the Firaxis developer had no clue about Lua and used colons in plenty of places where a dot was enough. ^^
Now, as long as the method does not take any argument, the hidden argument passed by the colon operator (this argument's value being the caller) will just be ignored, hence why it works in this case.

Now I guess I should add a note regarding this matter for static methods with no arguments, this error from Firaxis is quite common and you will not be the only one to wonder.
 
Thank you Gedemon, I am going to start tracking more inconsistencies soon, I will be sure to understand this one's source (probably some general-purpose function that takes an int as argument).
 
Hello FramedArchitect.

Actually, the beta period should be over. But there was a bug I didn't find time to fix (let's just say that investigating it was already very painful when I had the code in mind and that, today, it would take at the very least a few hours) and I lack time for now to do so, so I am afraid it is not going to change soon.

This is the only reason because the wiki is still flagged as beta, so that I could have been able to let the bot overwrite all pages at once once the bug would have been fixed, not because I wanted to control the content. So, anyway, there would be no need for approval. ;)

So now the question is whether we wait more, hoping that I will fix it soon enough, or whether we decide to leave the beta, live with the bugged pages and let people fix them as they find them (mainly some integers that have been wrongly inferred as enumerations).

Whatever we decide, you can update the pages as you want, it's just that if I fix the bug and restart the bot, every change you made would be lost.
 
Back
Top Bottom