1. #1

    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
    1,979
    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!

    Enhance your core Savage Worlds ruleset with SW Enhancement Extensions, get more to savage!
    Want to create SW NPCs quickly? Use SW NPC Maker extension!
    Want to prove your dices are cursed or blessed? Try out SW Roll Statistics

  3. #3
    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)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Log in

Log in