DICE PACKS BUNDLE
  1. #1

    Handling Return Values

    Trying to figure out how to get a return value from a function, so I can do stuff with it.

    Here's my test function:
    Code:
    function addThis(a, b)
    	Debug.chat("The sum is ")
    	return (a + b)
    end
    The call...
    Code:
    function onValueChanged()
    	local x = charManager.addThis(1, 25)
    	Debug.chat(x)
    end
    I just get an error and none of my debug info is printed...
    Tried it all local, from within the onValueChanged function (minus the charManager pointer) and it worked fine...

    I don't know what I'm missing...

  2. #2
    Where is your test function defined? Is it in an extension using a script tag with "charManager" (exactly) as the name? (i.e. <script name="charManager" file="..." /> )

    Regards,
    JPG

  3. #3
    Quote Originally Posted by Moon Wizard View Post
    Where is your test function defined? Is it in an extension using a script tag with "charManager" (exactly) as the name? (i.e. <script name="charManager" file="..." /> )

    Regards,
    JPG
    Yes, it's in a script file named charManager.lua. Here's the entry under base.xml
    <script name="charManager" file="campaign/scripts/charManager.lua" />

    I have other functions in there, which are executing just fine.

  4. #4
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,593
    Quote Originally Posted by bloodylemming View Post
    I just get an error and none of my debug info is printed...
    When you get an error please report the *exact* error message - this will help with identifying the issue.
    Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!

  5. #5
    Quote Originally Posted by Trenloe View Post
    When you get an error please report the *exact* error message - this will help with identifying the issue.
    Strange. It's working now. Maybe the reboot helped clear something...

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 Product Walkthrough Playlist

Log in

Log in