5E Product Walkthrough Playlist
  1. #1
    Varsuuk's Avatar
    Join Date
    Dec 2015
    Location
    New York
    Posts
    2,075

    Any implicit action on returning true/false/nil?

    My expectation is that it does nothing, but figured I'd ask in case my mind is about to be blown

    When a method (addTraitDB) is called where the return value is not explicitly checked, like so:

    Code:
    	for _,v in pairs(DB.getChildren(nodeSource, "traits")) do
    		addTraitDB(nodeChar, "reference_racialtrait", v.getPath());
    	end
    Does anything special happen based on what, if anything is returned by this method? [EDIT: like "exit the loop"]

    In the current implementation, there are returns each of:
    return;
    return false;
    (and the final all went well until the end
    return true;

    Is this is just "habit" and/or "in case in future" type coding?
    Last edited by Varsuuk; May 19th, 2019 at 04:26.

  2. #2
    Ikael's Avatar
    Join Date
    Jan 2008
    Location
    Finland/Joensuu
    Posts
    2,383
    Nothing happens implicitly. You would need to explicitly check returned value and do something according to it.
    "Alright, you primitive screwheads, listen up: THIS... is my BOOMSTICK!" -- Ash Williams, Army of Darkness

    Post your SavageWorlds ruleset feature requests and issue reports here!

  3. #3
    Varsuuk's Avatar
    Join Date
    Dec 2015
    Location
    New York
    Posts
    2,075
    Ok, then they just return the true/false nil values for chuckles I’ll edit my version of the method to not return anything since I do not yet have a reason to check the result either.

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
  •  
Starfinder Playlist

Log in

Log in