Need Help

im wondering how can i call this; suppose i need to create a next and pass some parameters. The following code give an error
[blockcode]
/Development/learn/main.lua:31: attempt to index local ‘mytext’ (a nil value)
[/blockcode]

[blockcode]
function newParticle()
local particle = display.newText("", 0, 0, “verdana”, 15 )
particle.xDefault = 0
particle.yDefault = 0
particle.text =“0”
particle:setReferencePoint (display.CenterReferencePoint )
particle:setTextColor( 255, 255, 255)
particle.objectName=“TracingObject”

function particle:update(_x,_y,_text)
particle.xDefault = _x
particle.yDefault = _y
particle.text =_text
end

function particle:destroy()
particle.xDefault = nil
particle.yDefault = nil
particle.text =nil
particle:removeSelf()
end
end

local mytext = newParticle()
mytext:update(“tap to continue”,100,100)
[/blockcode]
I appreciate your feedback [import]uid: 11038 topic_id: 4028 reply_id: 304028[/import]

Your function newParticle doesn’t return anything, it needs to have a “return particle” no? [import]uid: 9371 topic_id: 4028 reply_id: 12248[/import]

[code]
function newParticle()
local particle = display.newText("", 0, 0, “verdana”, 15 )
particle.xDefault = 0
particle.yDefault = 0
particle.text =“0”
particle:setReferencePoint (display.CenterReferencePoint )
particle:setTextColor( 255, 255, 255)
particle.objectName=“TracingObject”

function particle:update(_x,_y,_text)
particle.xDefault = _x
particle.yDefault = _y
particle.text =_text
end

function particle:destroy()
particle.xDefault = nil
particle.yDefault = nil
particle.text =nil
particle:removeSelf()
end

return particle; <end

local mytext = newParticle()
mytext:update(“tap to continue”,100,100)
[/code] [import]uid: 24 topic_id: 4028 reply_id: 12366[/import]

Thanks carols for your reply :slight_smile:

Mate i need your help in one thing please. How can I modify the above code for displaying different messages with different coordinates lets say after level completion, i need to display “Congratulation!”, next line “You have completed Level 2”, next line “You have scored: 4500”, then finally, “Tap on screen to continue to level 3”

Thanks [import]uid: 11038 topic_id: 4028 reply_id: 12478[/import]