Hey there, still getting used to Corona/Lua and this problem’s been driving me crazy. I have two buttons with event listeners that goto the function “GainMoney”. I would like button1 to pass the integer “1” but button2 to pass the integer “10”. What would be the best way to do this?
I intend to create Money and Button objects by emulating classes in LUA, would this be a bad idea?
Other tips/recommendations welcome, thanks!
Here’s some example code:
local function gainmoney(event) money = money + --event.money displaymoney.text = "You have $"..money return true end function scene:create( event ) beg = widget.newButton{ label = "Beg for Money", defaultFile = "button.png", width = 154, height = 40, onRelease = gainmoney -- send event.money=1 } work = widget.newButton{ label = "Work for money", defaultFile = "button.png", width = 154, height = 40, onRelease = gainmoney -- send event.money=10 }