added library, then when running the project I get runtime error, lib files not found?

I am running 2.3.0 I'm new CPM user, just bought it. Can you help me solve this problem?

I've placed lime in Documents/Lime_3_4_Jun_2011 and included lime.lua as a library in CPM preferences/libraries

then in main.lua I included

local lime = require("lime")

When I run the project I get:

The file sandbox for this project is located at the following folder:
(/Users/max/Library/Application Support/Corona Simulator/5-44A1D89E6A865A12E60C13312A47EB04)

Runtime error
...EFrifdk6T0vivNk+++TI/-Tmp-/TemporaryItems/5/lime.lua:47: module 'lime-utils' not found:resource (lime-utils.lu) does not exist in archive
no field package.preload['lime-utils']
no file '/var/folders/Ze/Ze02705EFrifdk6T0vivNk+++TI/-Tmp-/TemporaryItems/5/lime-utils.lua'
no file '/Applications/CoronaSDK/Corona Simulator.app/Contents/Resources/lime-utils.lua'
no file '/Applications/CoronaSDK/Corona Simulator.app/Contents/Resources/lime-utils.blu'

The Lime files need to be in the asset list of your project, not just in the Prefs > Libraries. Just drag the Lime files (there's more than one) and drop them on the asset list and they'll be added to your project. Then you should be good to go.

One could logically assume that things put into Prefs > Libraries would be available to projects, but that part of CPM is for the code generator -- it doesn't affect the individual projects.

Jay

PS - But wouldn't it be cool in a future version of CPM if it would grab a file from Prefs > Libs if it was missing from a project? Hmmm...

Hi Jay

I expected I guess CPM would grab also then rest of files and include them at runtime.

this video

http://coronaprojectmanager.com/learningcenter/video.php?m=571&t=Creating+New+Projects

it added the lib file to the assets, so I assumed, ok if it adds one of the lib files to the assets, if the lib is more then one file it would add somehow the path to it when Corona compiles or do some magic to pull it in.

As it is now if the lib is only one file, you dont have too do anything special but if the lib is several files, you have to pull in rest of them manually, if you use 10 external libs and they use lots of files, you'll end up pulling in all of them. How about pulling in all the files from the same catalog that the main lib file is in, when we click we want to add a lib. You could perhaps even analise what files a lib file is including and then just pull in those files, instead of all the files from the same catalog.

What do you think about that, shouln't be to hard to do and less work on our part when creating new projects?

Hi Jay,

I am also having the same problem as Nermion (using the CoronaUI Libs). I have just started using CPM after sometime away so don't know if this has always happened. Currently using version 2.4.0 (2).

Thanks.

Any files you want to use in your project must be added to the asset list for that project. That's the only way CPM knows you need them.

I don't know what files are needed for CoronaUI (I don't really use it at this time) but however many files there are, drag and drop them on the asset list for your project and they'll be added.

You don't have to actually copy them to your project directory on your hard drive, they just need to be added to the asset list. (That's one of the most powerful features of CPM -- allows you to have ONE copy of a library on your drive and still use it in multiple projects.)

If that doesn't fix your problem let me know.

Jay

Hi Jay,

So when you check the library names in the Code Generator window it only adds the "require" statements to the main.lua file and not the library files to the Asset list as well.

Because whats happening when I do this is it adds the "require statements to the main.lua file and only the first library in the list I have checked to the Asset list.

I have added all the library files in the Preference Window and they all have the correct locations.

So the way I understand it is:

1. Check the library name in the Code Generator window adds the "require" statements to the main.lua file.

2. Drag and drop the library file into the asset list and you are go to go.

Checking the names in the Code Generator *should* add them to the asset list of your new project.

if it doesn't it could mean one of two things --

1. Since you added the code to the Prefs > Libraries list you have moved the code file to a different location. CPM thinks it's still in the original location and can't find it to add to your project.

2. There's a bug in the Code Generator.

I *have* seen #1 happen multiple times -- you end up moving files around but don't update the location in Prefs > Libraries. I haven't seen #2 happen, but that's not to say that it's not possible. I don't write bug free code all the time (yet!).

You might want to see if the missing files are actually at the locations shown in Prefs > Libraries.

Jay

Nermion,

The problem with pulling in all the files that are in the same location as a lib file is you'd end up pulling in readme files, sample code, etc.

The whole "library" concept in CPM is going to get an overhaul later this year -- my hope is to have it in v3 which is planned to be a pretty major update.

A library will probably go from being a single file to being a "holder" which can contain one or more files. Adding the library will add as many files as that holder has.

Jay

Hi Jay,

I did a test to see what was happening, here is what I did:

1. Removed all library file from Libraries in the Preferences window

2. Closed CMP (just in case something was not saving)

3.Reopened CMP

4. Reloaded the library file in Libraries in the Preferences window using the Browse button to insure the correct location

5. Closed CMP again

6. Opened CMP and created new project

7. Checked al the Library files in the Code Generator (8 total for coronaui) and the hide statusbar

8. Set the build.settings/config,luau and click OK

9. Clicked OK

This is what was created:

The Asset List has the build.settings, config.lua, coronaui.lua and main.lua files.

main.lua has the 8 "require" statements.

Any ideas what is doing this?

Thanks
Triston

views:2168 update:2011/10/11 22:13:38
corona forums © 2003-2011