So I have a class called destroyer.
I want to increment the value of the destroyer.money by 5 every 500 frames, from inside the destroyer class script
to do this I need to pass in destroyer.money by reference otherwise i an just changing the value of a useless local variable.
QUESTION: how do you pass by reference in lua and corona sdk?
thanks in advance 
my code:
[lua]
–
– Destroyer.lua
–
local Destroyer = {}
local Destroyer_mt = { __index = Destroyer } – metatable
– PRIVATE FUNCTIONS
local function set_referance_point(object,x,y)
object:setReferencePoint(display.CenterReferencePoint);
object.x=x;
object.y=y;
end
local function make_money(money, income_rate)
money = money + income_rate
print(money);
end
local function got_touched( event )
print(“hi”)
if(event.phase==“began”) then
end
end
– PUBLIC FUNCTIONS
function Destroyer.new(x,y) – constructor
local newDestroyer =
{
Health = 100,
money = 1000,
income_rate=5,
object = display.newImage( “deathstar.png” )
}
set_referance_point(newDestroyer.object,x,y) – positions the Destroyer
local temp_touch_function = function() got_touched() end
newDestroyer.object:addEventListener( “touch”, temp_touch_function )
local temp_money_timer = function() make_money(newDestroyer.money, newDestroyer.income_rate) end
timer.performWithDelay( 500, temp_money_timer, -1) – gives Destroyer a runtime funciton
return setmetatable( newDestroyer, Destroyer_mt )
end
function Destroyer:print_confirmation()
print( “Destroyer Has been created” )
end
return Destroyer
[/lua]