# help with using libraries (mac)

**URL:** <https://forums.solar2d.com/t/help-with-using-libraries-mac/294089>\
**Category:** Outlaw Game Tools\
**Created:** [September 14, 2011, 8:56am UTC](https://forums.solar2d.com/t/help-with-using-libraries-mac/294089 "2011-09-14T08:56:09Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![mediakitchen2](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/m/bbe5ce/32.png) [@mediakitchen2](https://forums.solar2d.com/u/mediakitchen2)\
**Post date:** [September 14, 2011, 8:56am UTC](https://forums.solar2d.com/t/help-with-using-libraries-mac/294089/1 "2011-09-14T08:56:09Z")

</div>

just tried to add the director class as a library to a very minimal test project

first I added the director class via the preferences option in cpm

**director.lua Macintosh HD:Users:macuser:Documents:work:corona development:libraries:director\_by\_ricardo\_rauber\_1\_4:director.lua**

i then created a new project and set it to use a base folder called “test” on the desktop

i then went to tools - code generator and ticked the checkbox next to director.lua and copied the following code to clipboard

```auto
  
-- cpmgen main.lua  
  
local director = require("director")  
  
```

i then opened main.lua in cpm and pasted this code into it and saved it. This is the only code that main.lua contains.

when i do a test launch i get the following error

**Runtime error  
…R1ngViHfymXo+nGymTFE+++TI/TemporaryItems/11/main.lua:3: module ‘director’ not found:resource (director.lu) does not exist in archive  
no field package.preload[‘director’]  
no file ‘/var/folders/Jd/JdR1ngViHfymXo+nGymTFE+++TI/TemporaryItems/11/director.lua’  
no file ‘/Applications/CoronaSDK/Corona Simulator.app/Contents/Resources/director.lua’  
no file ‘/Applications/CoronaSDK/Corona Simulator.app/Contents/Resources/director.blu’  
stack traceback:  
[C]: ?  
[C]: in function ‘require’  
…R1ngViHfymXo+nGymTFE+++TI/TemporaryItems/11/main.lua:3: in main chunk  
Runtime error: …R1ngViHfymXo+nGymTFE+++TI/TemporaryItems/11/main.lua:3: module ‘director’ not found:resource (director.lu) does not exist in archive  
no field package.preload[‘director’]  
no file ‘/var/folders/Jd/JdR1ngViHfymXo+nGymTFE+++TI/TemporaryItems/11/director.lua’  
no file ‘/Applications/CoronaSDK/Corona Simulator.app/Contents/Resources/director.lua’  
no file ‘/Applications/CoronaSDK/Corona Simulator.app/Contents/Resources/director.blu’  
stack traceback:  
[C]: ?  
[C]: in function ‘require’  
…R1ngViHfymXo+nGymTFE+++TI/TemporaryItems/11/main.lua:3: in main chunk**

any ideas what the problem is?

cpm Version 2.7.1 (2)  
corona Version 2011.268 (2011.1.20) [import]uid: 11642 topic\_id: 15109 reply\_id: 315109[/import]

---

<div class="post-metadata">

**Author:** ![mediakitchen2](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/m/bbe5ce/32.png) [@mediakitchen2](https://forums.solar2d.com/u/mediakitchen2)\
**Post date:** [September 14, 2011, 9:10am UTC](https://forums.solar2d.com/t/help-with-using-libraries-mac/294089/2 "2011-09-14T09:10:45Z")

</div>

solved this one - i realise I need to add the director.lua file to my assets

in this case I am not really grasping the benefits of adding the library files - is it simply to ease adding the require line of code in the code generator? [import]uid: 11642 topic\_id: 15109 reply\_id: 55897[/import]

---

<div class="post-metadata">

**Author:** ![J\_A\_Whye](https://forums.solar2d.com/user_avatar/forums.solar2d.com/j_a_whye/32/74_2.png) [@J\_A\_Whye](https://forums.solar2d.com/u/J_A_Whye)\
**Post date:** [September 14, 2011, 1:20pm UTC](https://forums.solar2d.com/t/help-with-using-libraries-mac/294089/3 "2011-09-14T13:20:53Z")

</div>

In the next major version of CPM the libraries feature will get an overhaul or go away – I haven’t decided yet.

If you have a file in Libraries and check that box in the Code Generator, it should add the require() line and copy a link to that asset into your new project.

Saves a couple steps, but not really as earth-shattering as I’d like it to be. 🙂

Jay  
[import]uid: 9440 topic\_id: 15109 reply\_id: 55924[/import]

---

<div class="post-metadata">

**Author:** ![mediakitchen2](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/m/bbe5ce/32.png) [@mediakitchen2](https://forums.solar2d.com/u/mediakitchen2)\
**Post date:** [September 14, 2011, 2:20pm UTC](https://forums.solar2d.com/t/help-with-using-libraries-mac/294089/4 "2011-09-14T14:20:15Z")

</div>

thanks for the reply. Just to clarify: you said  
  
If you have a file in Libraries and check that box in the Code Generator, it should add the require() line and copy a link to that asset into your new project.

It didn’t appear to copy a link to that asset into my project - I had to add the asset using the add asset button [import]uid: 11642 topic\_id: 15109 reply\_id: 55933[/import]

---

<div class="post-metadata">

**Author:** ![mediakitchen2](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/m/bbe5ce/32.png) [@mediakitchen2](https://forums.solar2d.com/u/mediakitchen2)\
**Post date:** [September 14, 2011, 2:20pm UTC](https://forums.solar2d.com/t/help-with-using-libraries-mac/294089/5 "2011-09-14T14:20:16Z")

</div>

thanks for the reply. Just to clarify: you said  
  
If you have a file in Libraries and check that box in the Code Generator, it should add the require() line and copy a link to that asset into your new project.

It didn’t appear to copy a link to that asset into my project - I had to add the asset using the add asset button [import]uid: 11642 topic\_id: 15109 reply\_id: 55934[/import]

---

<div class="post-metadata">

**Author:** ![mediakitchen2](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/m/bbe5ce/32.png) [@mediakitchen2](https://forums.solar2d.com/u/mediakitchen2)\
**Post date:** [September 14, 2011, 2:20pm UTC](https://forums.solar2d.com/t/help-with-using-libraries-mac/294089/6 "2011-09-14T14:20:17Z")

</div>

thanks for the reply. Just to clarify: you said  
  
If you have a file in Libraries and check that box in the Code Generator, it should add the require() line and copy a link to that asset into your new project.

It didn’t appear to copy a link to that asset into my project - I had to add the asset using the add asset button [import]uid: 11642 topic\_id: 15109 reply\_id: 55935[/import]

---

<div class="post-metadata">

**Author:** ![mediakitchen2](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/m/bbe5ce/32.png) [@mediakitchen2](https://forums.solar2d.com/u/mediakitchen2)\
**Post date:** [September 14, 2011, 2:20pm UTC](https://forums.solar2d.com/t/help-with-using-libraries-mac/294089/7 "2011-09-14T14:20:18Z")

</div>

thanks for the reply. Just to clarify: you said  
  
If you have a file in Libraries and check that box in the Code Generator, it should add the require() line and copy a link to that asset into your new project.

It didn’t appear to copy a link to that asset into my project - I had to add the asset using the add asset button [import]uid: 11642 topic\_id: 15109 reply\_id: 55936[/import]

---

<div class="post-metadata">

**Author:** ![mediakitchen2](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/m/bbe5ce/32.png) [@mediakitchen2](https://forums.solar2d.com/u/mediakitchen2)\
**Post date:** [September 14, 2011, 2:22pm UTC](https://forums.solar2d.com/t/help-with-using-libraries-mac/294089/8 "2011-09-14T14:22:13Z")

</div>

Hmm seems to have duplicated my reply. Posting from ipad2 [import]uid: 11642 topic\_id: 15109 reply\_id: 55937[/import]

---

<div class="post-metadata">

**Author:** ![J\_A\_Whye](https://forums.solar2d.com/user_avatar/forums.solar2d.com/j_a_whye/32/74_2.png) [@J\_A\_Whye](https://forums.solar2d.com/u/J_A_Whye)\
**Post date:** [September 14, 2011, 6:49pm UTC](https://forums.solar2d.com/t/help-with-using-libraries-mac/294089/9 "2011-09-14T18:49:24Z")

</div>

It is \*supposed\* to copy the chosen library into the project – I’ll take a look at that.

Also, instead of using Add New Asset to pull in something like Director, if you keep all your “library-type” files in a project, you can switch to that and drag and drop the wanted libraries to your new project folder. A little faster than going through the menu+open dialog.

Jay  
[import]uid: 9440 topic\_id: 15109 reply\_id: 55966[/import]
