Anonymous error

The game is running for the first time But when i go back to the main page and then i play again i get the error
[lua]attempt to call method ‘remove’ [/lua]

please take me out of this problem. [import]uid: 82446 topic_id: 17804 reply_id: 317804[/import]

This is a user error - you’re likely trying to remove an object that doesn’t exist. If you are using a timer to remove something before switching back to the main page this may be the issue.

Peach :slight_smile: [import]uid: 52491 topic_id: 17804 reply_id: 68101[/import]

yes I have figured it out .Moreover the promlem lies with one of my file(scor.lua)
Could you help me telling how to use that score.lua with director class
[lua]module(…, package.seeall)

local numbers = {
[string.byte("-")] = “-.png”,
[string.byte(“0”)] = “0.png”,
[string.byte(“1”)] = “1.png”,
[string.byte(“2”)] = “2.png”,
[string.byte(“3”)] = “3.png”,
[string.byte(“4”)] = “4.png”,
[string.byte(“5”)] = “5.png”,
[string.byte(“6”)] = “6.png”,
[string.byte(“7”)] = “7.png”,
[string.byte(“8”)] = “8.png”,
[string.byte(“9”)] = “9.png”,
[string.byte(" ")] = “space.png”,
}

local scoreGroup = display.newGroup()

local scorebgimg = display.newImage( “scorebg.png” )
scoreGroup:insert( scorebgimg )

local backgroundBorder = 10

scoreGroup:insert( scorebgimg )

local numberGroup = display.newGroup()
scoreGroup:insert( numberGroup )

local theScore = 0

function init( params )
scoreGroup.x = params.x
scoreGroup.y = params.y
setScore( 0 )
end

function getInfo()
return {
x = scoreGroup.x,
y = scoreGroup.y,
xmax = scoreGroup.x + scoreGroup.contentWidth,
ymax = scoreGroup.y + scoreGroup.contentHeight,
contentWidth = scoreGroup.contentWidth,
contentHeight = scoreGroup.contentHeight,
score = theScore
}
end
function update()

scoreGroup:remove(2)

local numberGroup = display.newGroup()
scoreGroup:insert( numberGroup )

local scoreStr = tostring( theScore )

local scoreLen = string.len( scoreStr )
local i = scoreLen

local x = scoreGroup.contentWidth - backgroundBorder
local y = scoreGroup.contentHeight / 2

while i > 0 do
local c = string.byte( scoreStr, i )
local digitPath = numbers[c]
local characterImage = display.newImage( digitPath )

numberGroup:insert( characterImage )

characterImage.x = x - characterImage.width / 2
characterImage.y = y
x = x - characterImage.width
i = i - 1
end
end

function getScore()
return theScore
end

function setScore( score )
theScore = score
update()
end[/lua] [import]uid: 82446 topic_id: 17804 reply_id: 68109[/import]

What do you mean how to use it with Director class? You use it in the normal way. (There’s a tutorial for it’s normal use on Techority.com)

If you wish to hide it one certain scenes you can remove it or you can move it so it is hidden outside of the screen then move it back when you need it again. It’s up to you.

Peach :slight_smile: [import]uid: 52491 topic_id: 17804 reply_id: 68119[/import]