0 Members and 4 Guests are viewing this topic.
function on.charIn(char) .... elseif place == "bank" then if char=="0" or char=="1" or char=="2"or char=="3"or char=="4"or char=="5"or char=="6"or char=="7"or char=="8"or char=="9" then if transaction == 0 then transaction = char + 0 else transaction = transaction..char end elseif char == "-" then banktype = -1 line6 = "Withdraw : "..transaction elseif char == "+" then banktype = 1 line6 = "Deposit : "..transaction end end ....endfunction on.enterKey() .... elseif place == "bank" then if transaction ~= 0 and transaction ~= nil then money = 0 + transaction if bankgold >= -1*money and money <= gold then bankgold = bankgold + (banktype*money) gold = gold - (banktype*money) end line2 = "Balance : "..bankgold transaction = 0 end end ....end
if char=="0" or char=="1" or char=="2"or char=="3"or char=="4"or char=="5"or char=="6"or char=="7"or char=="8"or char=="9" then
Quoteif char=="0" or char=="1" or char=="2"or char=="3"or char=="4"or char=="5"or char=="6"or char=="7"or char=="8"or char=="9" thenin python, it would just be "if char in {"1","2","3","4","5","6","7","8","9","0"}" I haven't really figured out a good way to shorten this either.
function on.create() initChoice = 1 showEquip = 0 showUp = 0 mainChoice = 1 magicSelect = 0 race = "Spirit" mainMenu = 1 init = 0 escMenu = 0 line = {} for i=1, 10 do line[i] = "" end castleLine = {} for i=1, 4 do castleLine[i] = "" end townLine = {} for i=1, 10 do townLine[i] = "" end combatLine = {} for i=1,8 do combatLine[i] = "" end upLine = {} for i=1, 8 do upLine[i] = "" end talkLine = {} for i=1,5 do talkLine[i] = "" end platform.window:invalidate() --what else would be good to do as the program initializes?endfunction on.paint(gc) ... for i=1,#talkLine do gc:drawString(talkLine[i], 5, 20+shm*(i-1)) end ...