User Tag List

Results 1 to 6 of 6

Thread: LUA return-functions

  1. #1
    Clicker Fusion 2.5 DeveloperSWF Export ModuleUnicode Add-on
    Looki's Avatar
    Join Date
    Aug 2006
    Location
    Karlsruhe, Germany
    Posts
    3,739
    Mentioned
    4 Post(s)
    Tagged
    1 Thread(s)

    LUA return-functions

    Hello everybody, I've been trying to implement a script language in a little project, but I need to know how to work with "return-functions".
    E.g. set_x(get_x("Player1")+200)
    But I don't get it working,
    I always get an error!


  2. #2
    Clicker Fusion 2.5 Developer

    Join Date
    Jun 2006
    Posts
    414
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: LUA return-functions

    I love lua...

    But I need some more details before I can help.

    Where are you calling functions?

    Are you calling Lua functions and hoping they will return things for you?
    Let me see some more of your code, and be sure to specify where the code comes from (for each part). That is, is this lua code or MMF code.

    Other than that, look at the examples in MMF2\Examples\Lua.
    If you can't find where the lua code is, remember that vortex liked to put them into the LUA Object's properties. So look there. hehe

  3. #3
    Clicker Fusion 2.5 DeveloperSWF Export ModuleUnicode Add-on
    Looki's Avatar
    Join Date
    Aug 2006
    Location
    Karlsruhe, Germany
    Posts
    3,739
    Mentioned
    4 Post(s)
    Tagged
    1 Thread(s)

    Re: LUA return-functions

    sorry, I haven't saved my test app...
    I called the following script:
    Code:
    function get()
    DoCall("get");
    end
    
    function set(x)
    DoCall("set",x);
    end
    
    set(get()+1);
    This script should move the object 1 px to the right.
    I had 2 function events:

    On Function get
    Set return Str$(x("Active"))

    On Function set
    Set X of Active to LuaValParam(0)

  4. #4
    No Products Registered

    Join Date
    Jun 2006
    Location
    Texas
    Posts
    1,002
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: LUA return-functions

    You need

    Code:
    function get()
    return DoCall("get");
    end
    That should fix your problem.

  5. #5
    Clicker Fusion 2.5 DeveloperSWF Export ModuleUnicode Add-on
    Looki's Avatar
    Join Date
    Aug 2006
    Location
    Karlsruhe, Germany
    Posts
    3,739
    Mentioned
    4 Post(s)
    Tagged
    1 Thread(s)

    Re: LUA return-functions

    Yes, it works!!
    Thank you very much!

  6. #6
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleSWF Export ModuleXNA Export Module
    Fusion 2.5 (Steam)
    Mathias's Avatar
    Join Date
    Jun 2006
    Location
    Copenhagen, Denmark
    Posts
    1,083
    Mentioned
    9 Post(s)
    Tagged
    0 Thread(s)

    Re: LUA return-functions

    Hey, I have a problem with the return function too. It's not with the language itself, but more the way MMF handles it. I have a subapplication and a GFO object. In the subapplication there's a MooGame object. Everything works fine, but what I want to do is to when the function "getidfromusername" function is called in Lua to MMF, how can I get the return of the "id from username" function in the MooGame object in the subapp? If I send the function with GFO and I wait untill I get an answer back, and I first return it at that time, the Lua function returns nil. Any ideas?

Similar Threads

  1. If <=10 return 1, if <10 return 0
    By King_Cool in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 9th October 2012, 10:08 PM
  2. Return a Float
    By Jaffob in forum Extension Development
    Replies: 3
    Last Post: 3rd April 2009, 11:05 PM
  3. Return of the most common MMF bug!
    By MechatheSlag in forum Multimedia Fusion 2 - Technical Support
    Replies: 20
    Last Post: 5th September 2006, 07:36 PM

Posting Permissions

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