Hi guys,
I made a quite simple code to explain a problem that I have referencing a function.
As you see, at the two.lua file, I want to call a function of the main.lua file.
Could anyone tell me the right way to do this?
Thanks in advance and sorry for my english!
–
–main.lua
local ui = require(“ui”)
local two = require(“two”)
local backgroundWidth = 320
local backgroundHeight = 480
local localGroup = display.newGroup()
local background = display.newRect(0,0,backgroundWidth, backgroundHeight)
background:setFillColor(255,255,255,50)
local function firstFunct()
print(“First function”)
end
localGroup:insert(background)
local one = two.new()
–two.lua
module(…, package.seeall)
local buttonPressed = function (event)
if event.phase == “release” then
– Here I want to call the function firstFunction()
end
end
local buttonPress = ui.newButton{
default = “buttonBlue.png”,
over = “buttonBlueOver.png”,
onEvent = buttonPressed,
text = “Press me”,
font = native.systemFont,
size = 14,
emboss = true
}
function new()
buttonPress.x=165
buttonPress.y=200
end [import]uid: 44013 topic_id: 7876 reply_id: 307876[/import]