FG Spreadshirt Swag

Thread: DB.getValue

  1. #1
    Varsuuk's Avatar
    Join Date
    Dec 2015
    Location
    New York
    Posts
    2,075

    DB.getValue

    [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

    Code:
    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 05:40.

  2. #2

  3. #3
    Varsuuk's Avatar
    Join Date
    Dec 2015
    Location
    New York
    Posts
    2,075
    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)

Bookmarks

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 Character Create Playlist

Log in

Log in