Sprite Sheets not working

When I run my code from corona project manager, I get this:

"module 'sprite' not found:resource (sprite.lu) does not exist in archive
no field package.preload['sprite']"

along with other errors regarding not being able to find the files needed for local sprite=require"sprite"

If I run my same code out of corona it works fine.

Please help!!

I've run quite a few sprite-based projects in CPM so it's something other than "sprite sheets don't work."

In the Ansca sample projects I'm seeing

require "sprite"

...and not...

local sprite = require "sprite"

Not sure if that would be the source of your problems, but it's something to check out.

Also, not sure if it was just a copy/paste typo, but part of the error message you show:

resource (sprite.lu) does not exist

...makes it look as if it's looking for a file called sprite.lu -- should that be sprite.lua?

If none of those things makes a difference zip up the file and send it to me: j@jawhye.com

Jay

They work for me as well. Did you drag & drop all assets into CPM?

Oh, ksan has a good point -- CPM doesn't look in your project folder on your drive -- it only cares about the assets you've specified in the CPM project (which is by design, so you can have extra code, graphics, etc., and not worry about them getting mixed in with only the stuff you need to build your project).

Make sure all the files referenced in your code are added as assets in the CPM project.

Jay

I just created a new project in corona, with a main.lua that only has this:

local sprite = require ("sprite")

and I get the following:

Copyright (C) 2009-2010 A n s c a , I n c .
Version: 2.0.0
Build: 2010.9.16.148
The file sandbox for this project is located at the following folder:
(/Users/charlesaudler/Library/Application Support/Corona Simulator/43-FA205199E2670C33DBCA4AF7EE0DC98A)
Runtime error
...yiCznVGACEx2QTeG7ytk+++TI/TemporaryItems/43/main.lua:11: module 'sprite' not found:resource (sprite.lu) does not exist in archive
no field package.preload['sprite']
no file '/private/var/folders/Tm/TmyiCznVGACEx2QTeG7ytk+++TI/TemporaryItems/43/sprite.lua'
no file '/Applications/Corona.243/CoronaSDK/Corona Simulator.app/Contents/Resources/sprite.lua'
no file '/Applications/Corona.243/CoronaSDK/Corona Simulator.app/Contents/Resources/sprite.blu'
stack traceback:
[C]: ?
[C]: in function 'require'
...yiCznVGACEx2QTeG7ytk+++TI/TemporaryItems/43/main.lua:11: in main chunk
Runtime error: ...yiCznVGACEx2QTeG7ytk+++TI/TemporaryItems/43/main.lua:11: module 'sprite' not found:resource (sprite.lu) does not exist in archive
no field package.preload['sprite']
no file '/private/var/folders/Tm/TmyiCznVGACEx2QTeG7ytk+++TI/TemporaryItems/43/sprite.lua'
no file '/Applications/Corona.243/CoronaSDK/Corona Simulator.app/Contents/Resources/sprite.lua'
no file '/Applications/Corona.243/CoronaSDK/Corona Simulator.app/Contents/Resources/sprite.blu'
stack traceback:
[C]: ?
[C]: in function 'require'
...yiCznVGACEx2QTeG7ytk+++TI/TemporaryItems/43/main.lua:11: in main chunk

Can you post your newly created project here? I can try to run it on my end and see what happens.

Thanks for the help!

I just tried re-installing corona and then tried the project(s) and they work fine.

Maybe something became corrupt at some point. It's just weird that it worked in corona terminal but not cpm.

Thanks again!!

Glad to hear its allright. Have fun!

Weird, but glad it works now! Thanks for the follow-up!

Jay

I could sure use help. Having a similar problem. New to Lua. I am trying to create a separate class file called "CreditsDlg.lua". No matter what I do, the program chokes at this line:

1
require ("CreditsDlg.lua")

Try doing this:

require ("CreditsDlg")

Don't include the .lua suffix and see what happens.

Jay

Jay-

Thanks for the reply! I tried that before, but I was missing this line at the top of my class file:

module(..., package.seeall)

That, combined with removing the '.lua' extension, did the trick. Thanks!

-Dune

views:3358 update:2011/10/12 9:17:43
corona forums © 2003-2011