local function create_book(self)
-- attempt to call global 'delete_book' (a nil value)
delete_book(self)
self.book_id = factory.create("#random-book-factory", vmath.vector3(-1.0, 0, 0))
go.set(self.book_id, "position.x", 0.0)
go.animate(self.book_id, "position.x", go.PLAYBACK_ONCE_FORWARD, 100, go.EASING_INQUART, 2)
sound.play(self.book_id.."#sliding-sound")
end
local function delete_book(self)
if self.book_id then
go.set(self.book_id, "position.x", -1.0)
go.animate(self.book_id, "position.x", go.PLAYBACK_ONCE_FORWARD, 100, go.EASING_INQUART, 2)
sound.play(self.book_id.."#sliding-sound")
go.delete(self.book_id)
self.book_id = nil
end
end
So I’m getting an error -- attempt to call global 'delete_book' (a nil value)
, but I don’t think that should be happening since there’s the if statement, so I’m confused?