Page 2 of 2 FirstFirst 12
Results 11 to 14 of 14

Thread: lua help

                  
   
  1. #11
    PSP User crait's Avatar
    Join Date
    Jul 2006
    Posts
    212
    Rep Power
    69

    Default

    man, thats dum, ill upload, then pm you with a link

  2. #12
    GP2X Coder/Moderator
    Join Date
    Jan 2006
    Posts
    1,678
    Rep Power
    87

    Default

    Nevermind, I fixed the error:
    if pad:left() and Player.jumpstate == "ground" and (Player.image == Playerp or Player.image == Playerp2) then
    Player.image = Player2
    Player.x=Player.x-4
    end

    if pad:right() and Player.jumpstate == "ground" and (Player.image == Playerp or Player.image == Playerp2) then
    Player.image = Player1
    Player.x=Player.x+4
    end
    Add the brackets. The problem is that lua is reading that left to right so it reads:

    if (a and b) or c

    By putting the brackets round an expression means you are saying that it needs to be evaluated first before anything else. It falls down to order of operation. eg maths

    a * b + c == (a * b) + c

    but if you wanted b + c to be done first then:

    a * (b + c)

  3. #13
    PSP User crait's Avatar
    Join Date
    Jul 2006
    Posts
    212
    Rep Power
    69

    Default

    makes total since

  4. #14
    PSP User crait's Avatar
    Join Date
    Jul 2006
    Posts
    212
    Rep Power
    69

    Default

    Thanks!

Page 2 of 2 FirstFirst 12

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

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
  •