[Resolved] Problems with new sprite API

In the past I was using the old API and Zwoptex to handle my sprites, but I’m making the change over to the new API while still using Zwoptex and the old data files, and I’m running into problems.

Here is what my code looks like with an urchin.lua file in the main directory and the sprite sheet in /images folder, both made with Zwoptex.
local oldStyleSpriteSheetData = require(“urchin”).getSpriteSheetData()

local urchinOptions =
{
spriteSheetFrames = oldStyleSpriteSheetData.frames
}

local urchinSheet = graphics.newImageSheet( “images/urchin.png”, urchinOptions )

local sequenceData = {
name=“cycle”,
start=1,
count=4,
time=100,
loopCount = 0
loopDirection = “bounce”
}

local urchin = display.newSprite( urchinSheet, sequenceData )
urchinOne.x = 320
urchinOne.y = 525
localGroup:insert(urchinOne)

And here is the error message I am getting…

Runtime error
/Users/anthonygrajirena/Desktop/wm/director.lua:440: ERROR: table expected. If this is a function call, you might have used ‘.’ instead of ‘:’
stack traceback:
[C]: ?
[C]: in function ‘insert’
/Users/anthonygrajirena/Desktop/wm/director.lua:440: in function ‘_listener’
?: in function <?:531>
?: in function <?:226>

Any help would be great, thanks. [import]uid: 10356 topic_id: 30903 reply_id: 330903[/import]

I’ve realized the naming error in calling the sprite urchin while the following lines address urchinOne. Changing this does not have any affect and I still get a 440 error from director, which handles : currView:insert( currScreen ) [import]uid: 10356 topic_id: 30903 reply_id: 123598[/import]

This has been solved. It was an issue of the order in which the information was placed. [import]uid: 10356 topic_id: 30903 reply_id: 123599[/import]

You also seem to have missing comma at end of loopCount line.

FYI helps to post code in < lua > and < /lua > tags, without the spaces, to make it legible :wink: [import]uid: 52491 topic_id: 30903 reply_id: 123747[/import]

I’ve realized the naming error in calling the sprite urchin while the following lines address urchinOne. Changing this does not have any affect and I still get a 440 error from director, which handles : currView:insert( currScreen ) [import]uid: 10356 topic_id: 30903 reply_id: 123598[/import]

This has been solved. It was an issue of the order in which the information was placed. [import]uid: 10356 topic_id: 30903 reply_id: 123599[/import]

You also seem to have missing comma at end of loopCount line.

FYI helps to post code in < lua > and < /lua > tags, without the spaces, to make it legible :wink: [import]uid: 52491 topic_id: 30903 reply_id: 123747[/import]

Can I use Zwoptex without this --> local sprite = require(“sprite”) on graphics 2.0?

Can I use Zwoptex without this --> local sprite = require(“sprite”) on graphics 2.0?