local function do_something(self, node, count)
-- some code
if count == 10 then
-- some code
end
end
I would like to pass the parameter “count” to the do_something function, and this parameter has to be inherent to the instance to the node in use (so I can’t use self.count or global variables ecc). I have read an answer that suggests to write this:
I don’t understand; in the below code, the value printed is count=nil
local function do_something(self, nodo_lettera_volante, count)
pprint(count)
end
function on_message(self, message_id, message, sender)
local count=123
if message_id == hash("go_fly_letter") then
gui.animate(nodo_lettera_volante, gui.PROP_POSITION, gui.get_position(nodo_lettera_volante), gui.EASING_NONE, 0.5, 0.0, function ()
do_something(count)
end)
end
end