PDA

View Full Version : How do you use getRulesetVersion()?



Spyke
September 18th, 2008, 11:01
I'm having difficulty using getRulesetVersion(). In the documentation it says that this returns a table, though the text would suggest that it simply returns the release number.

In the ruleset base.xml I have the line:

<root version="2.0" release="12">

I am calling getRulesetVersion() from a Host session, and trying to populate it as follows:


local ruleset = {};
ruleset = DB.findNode("charsheet").getRulesetVersion();
If I try to manipulate ruleset as a table I get errors that state that this is a number not a table, e.g. by trying:

print (table.maxn(ruleset));

or

print (ruleset[1].release.getValue());

I have a valid databasenode as DB.findNode("charsheet").getName() returns "charsheet", but the following returns 0:

print (DB.findNode("charsheet").getRulesetVersion());

Any help would be much appreciated.

Spyke

Goblin-King
September 19th, 2008, 06:53
There was a copy-paste error in the documentation that I've fixed. The function returns two numbers, the major and the minor version. The usage is:


local major, minor = dbnode.getRulesetVersion()
It returns zeros if the release version is not defined in the ruleset.

However, there is a known bug in actually saving the release version in the data base. It's fixed in our internal version that should be out in a few days. If you want to test your scripting in the mean time, you should be able to do that by appending a "release" attribute to the root element of db.xml.

Spyke
September 19th, 2008, 09:29
Thanks Tero, I've just tried it and it works fine now. :)