-
March 30th, 2019, 19:05 #1
DB.getValue() parameter double-check
[RESOLVED]
I see in the 5E addCharRef code the line:
for _,v in pairs(aCharClassNodes) do
local _,sExistingClassPath = DB.getValue(v, "shortcut", "", "");
I am not sure what the 2nd "" stands for. On the API page it only mentions 3 arguments.
https://www.fantasygrounds.com/refdoc/DB.xcp#getValue
I understand extras in Lua are "ignored", but checking in case it is because of an enhancement to the API that didn't make the web page.Last edited by Varsuuk; March 31st, 2019 at 03:35.
-
March 30th, 2019, 20:45 #2
Shortcut contains a "class" and "record" values.
local sClass, sRecord = DB.getValue(node, "shortcut", "", "");
DB.setValue(nodeClass, "shortcut", "windowreference", sClass, sRecord);
sClass = "item" or "charsheet" or "npc".
sRecord="item.id-00001" or "charsheet.id-00312"---
Fantasy Grounds AD&D Reference Bundle, AD&D Adventure Bundle 1, AD&D Adventure Bundle 2
Documentation for AD&D 2E ruleset.
Custom Maps (I2, S4, T1-4, Barrowmaze,Lost City of Barakus)
Note: Please do not message me directly on this site, post in the forums or ping me in FG's discord.
-
March 31st, 2019, 03:35 #3
I GET it now. I read the "function getValue( sourcenode, [subpath], [default] )" and would have expected: "function getValue( sourcenode, [subpath], [default, ...] )" or some symbology to indicate multiple defaults.
I knew it returned two values for this method (I print these generally to find out) but it never occurred to me that the it was for multiple "defaults" to return - which of course makes sense
The key, of course, that I missed being the "(s)"
default (...) [optional] The value(s) to be returned if getValue fails. (node does not exist; or non-value node)
Thanks
-
March 31st, 2019, 08:36 #4---
Fantasy Grounds AD&D Reference Bundle, AD&D Adventure Bundle 1, AD&D Adventure Bundle 2
Documentation for AD&D 2E ruleset.
Custom Maps (I2, S4, T1-4, Barrowmaze,Lost City of Barakus)
Note: Please do not message me directly on this site, post in the forums or ping me in FG's discord.
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks