User Tag List

Results 1 to 7 of 7

Thread: String Comparisons In Lua Code?

  1. #1
    Clicker Multimedia Fusion 2 DeveloperSWF Export Module

    Join Date
    Aug 2006
    Posts
    2,335
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    String Comparisons In Lua Code?

    Hi, i am not really good with Lua yet but i have been working with it ok and have been coding various OpenGL things fine. If i just set and get variables through mmf events things work fine but one thing i cannot seem to get running though is making comparisons within the actual lua code.

    For example i try this code -

    Code:
    function Go()
      if string "test" = "working" then
        string "works" = "it works"
      else
        string "works" = "it does not work"
      end
    end
    and it highlights the text like it recognizes but after i have set the "test" string to "working" at start of frame and call the "Go" function when i try to receive the "works" variable it will return nothing. So i am fairly sure i am doing something wrong so i am hoping someone can explain how to do this correctly and also for floats as this would help a lot, thanks

  2. #2
    No Products Registered

    Join Date
    Aug 2006
    Posts
    984
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: String Comparisons In Lua Code?

    you should be using '==' in your if test

  3. #3
    Clicker Multimedia Fusion 2 DeveloperSWF Export Module

    Join Date
    Aug 2006
    Posts
    2,335
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: String Comparisons In Lua Code?

    Thanks, do you mean like -

    Code:
    function Go()
      if string "test" == "working" then
        string "works" = "it works"
      else
        string "works" = "it does not work"
      end
    end
    because it still doesn't work, if i test and set the string variable to "hi" at the start of the frame it receives it though. Is that how you would set the new strings within the code? it seems like it should work but not sure why it won't.

  4. #4
    Clicker Multimedia Fusion 2
    Retriever2's Avatar
    Join Date
    Jun 2006
    Location
    United States
    Posts
    502
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: String Comparisons In Lua Code?

    Code:
    function Go()
      if myStringTest == "working" then
        stringWorks = "it works"
      else
        stringWorks = "it does not work"
      end
    end
    ?

  5. #5
    Clicker Multimedia Fusion 2 DeveloperSWF Export Module

    Join Date
    Aug 2006
    Posts
    2,335
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: String Comparisons In Lua Code?

    That doesn't seem to work either Retriever2

  6. #6
    No Products Registered

    Join Date
    Aug 2006
    Posts
    984
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: String Comparisons In Lua Code?

    Quote Originally Posted by Retriever2
    Code:
    function Go()
      if myStringTest == "working" then
        stringWorks = "it works"
      else
        stringWorks = "it does not work"
      end
    end
    ?
    lol i didn't notice the string 'declarations' floating around in there

    that's what i get for using parentheses-less function calls

    EDIT: is this what you're trying to do?

  7. #7
    Clicker Multimedia Fusion 2 DeveloperSWF Export Module

    Join Date
    Aug 2006
    Posts
    2,335
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: String Comparisons In Lua Code?

    xyzzy that works great, i can see what i was doing wrong now also. Thanks for the help everyone

Similar Threads

  1. Cycling string object colors through code
    By mobichan in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 28th December 2011, 03:34 PM
  2. Application Comparisons
    By artician in forum The Games Factory 2 - Technical Support
    Replies: 3
    Last Post: 16th May 2008, 01:10 AM
  3. Direction comparisons
    By Dines in forum Multimedia Fusion 2 - Technical Support
    Replies: 11
    Last Post: 2nd March 2008, 07:41 PM
  4. Replies: 0
    Last Post: 10th January 2008, 03:32 PM
  5. Object Instance Comparisons
    By Dines in forum Extension Development
    Replies: 5
    Last Post: 25th December 2007, 07:01 AM

Posting Permissions

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