SWADE Playlist

Thread: DB.getValue

  1. #1


    [EDIT - ignore title, someone moved posts around - the title refers to a previously posted and solved thread which still exists with same name below... ]

    The following is from MoreCore:manager_char_mc.lua

    function addClassLevel(nodeChar, sClass, sRecord, nLevel)
    	local nodeSource = resolveRefNode(sRecord);
    		Debug.console("nodeChar: ", nodeChar);
    		Debug.console("sClass: ", sClass);
    		Debug.console("sRecord: ", sRecord);
    	local nLevel = DB.getValue(nodeChar, "pcclasslevel", "number");
    Is the code doing what I think it is doing? i.e., if nodeChar.pcclasslevel does not exist, the value "number" is returned (which is a string instead of the number type expected)?

    If I read it right (rusty and wasn't ever a pro), it probably should be:
    local nLevel = DB.getValue(nodeChar, "pcclasslevel", 0);
    Last edited by Varsuuk; January 6th, 2021 at 06:40.

  2. #2
    damned's Avatar
    Join Date
    Mar 2011
    Blog Entries
    You are probably right.

    MoreCore - Generic Ruleset
    --- Projects ---
    Extensions | Tutorials | MoreCore | MoreCore Themes | Call of Cthulhu | Maelstrom | FG Con

  3. #3
    In this case, it isn't likely to be able to cause a problem since, if I recall, pcclasslevel is a control and therefore already exists so the "default" part of that will never trigger.

    This was just me noticing the mismatch and commenting for an "as-u-go" fix if I was correct.
    Damned - what's best way to report anything if see something? Discord message, post here in Workshop, or post in OtherRulesets/MoreCore? (I was going to post in the last one but thought since was code maybe here?)

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
5E Product Walkthrough Playlist

Log in

Log in