Announcement

Collapse
No announcement yet.

Help on Multi Function

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Help on Multi Function

    function Songs()
    a = Audio.Load(CHANNEL_NARRATION, "AutoPlay\\Audio\\Perfect.mp3", true, false);
    b = Audio.Load(CHANNEL_NARRATION, "AutoPlay\\Audio\\Lovehurts.mp3", true, false);
    end


    Button 1 on click
    Songs(a)

    Button 2 on click
    Songs(b)

    the code above is not work.. anyone could help me on this?

  • #2
    Hi telco, you should really read the manual - Look up "Function"
    Returning Values

    The next step is to make the function return values back to the calling script. Here is a function that accepts a number as its single argument, and then returns a string containing all of the numbers from one to that number.
    Code:
    function Songs(str)
    if str == "a" then
    Audio.Load(CHANNEL_NARRATION, "AutoPlay\\Audio\\Perfect.mp3", true, false);
    end
    if str == "b" then
    Audio.Load(CHANNEL_NARRATION, "AutoPlay\\Audio\\Lovehurts.mp3", true, false);
    end
    end
    
    Btn1
    Songs("a")   -- or a="a" Songs(a)
    
    Btn2
    Songs("b")
    That's arough conversion of your code

    Comment


    • #3
      thank you charliechaps

      Comment

      Working...
      X