Nesting files?

Oh, by the way, I’m not nesting several folders deep. I have one folder - CBEffects - that has all of the files inside of it in the main folder. [import]uid: 147322 topic_id: 33993 reply_id: 135147[/import]

Hmm. Well maybe I can take a look at it tonight when I get back to the dev machine. Would the error pop up if I try to include it into an otherwise blank project? [import]uid: 41884 topic_id: 33993 reply_id: 135149[/import]

I don’t know… I’ve never built for a device before. I was just going by the people’s comments. [import]uid: 147322 topic_id: 33993 reply_id: 135151[/import]

Hi Caleb (or Richard),
Can you give me a quick example of one of these “requires” you’re doing? And also a basic example of the folder structure, as in “Folder > File / File / File” ?

Thanks! [import]uid: 200026 topic_id: 33993 reply_id: 135152[/import]

Here’s my require code for CBEffects main library -
[lua]local masterPresets=require(“CBEffects.ParticlePresets”)
require(“CBEffects.ParticleHelper”)
local masterPhysics=require(“CBEffects.ParticlePhysics”)[/lua]

And here’s the directory map:
[text]
-Main Directory
(whatever the other folders were)
-CBEffects (inside of Main Directory, not nested in anything else)
-Library.lua
-ParticlePresets.lua
-ParticleHelper.lua
-ParticlePhysics.lua
-And some art (.png files)
[/text]
And apparently it works like this:
[text]
-Main Directory
(whatever the other folders were)
-Library.lua
-ParticlePresets.lua
-ParticleHelper.lua
-ParticlePhysics.lua
-And some art (.png files)
[/text] [import]uid: 147322 topic_id: 33993 reply_id: 135154[/import]

Yeah I use local myLibrary = require("foldername.myLibrary") as well.

Not sure what happens when you require in a folder’d lib without assigning a variable, but nothing seems wrong there. Anyway if Brent doesn’t see anything first I’ll check when I have dev access tonight. [import]uid: 41884 topic_id: 33993 reply_id: 135157[/import]

Hi Caleb and Richard,
It appears that your “require” call and directory is correct. Are you implementing this is in different Storyboard or Director scenes or something? My suspicion is that Lua isn’t able to call the various CBEffects module(s) properly from external modules, or something like that… but I need to learn more details about your usage before I can make that assumption fairly.

Keep me posted,
Brent
[import]uid: 200026 topic_id: 33993 reply_id: 135174[/import]

Good: Just using a blank main.lua and adding in CBEffects as a folder, I’m not getting any error messages.
Bad: I must really suck at following documentation because I don’t get any screen output using this code:

[code]local CBE = require(“CBEffects.Library”)
print(“Test”)

local CBObject = CBE.new{
{
preset = “hyperspace”,
}
}

CBObject:start()[/code]

No errors either, mind you, but…have no idea what it actually takes to get that package working. [import]uid: 41884 topic_id: 33993 reply_id: 135181[/import]

If you modules are designed correctly you should be able to do the following and get a table (after doing the require):

print( CBE )

If it comes out nil then it’s not finding the library.

Also pay attention to the case of the file names. Make sure everything matches.

You should get in the habit of using the form label = require( "name" ) to avoid issues in the future. [import]uid: 7559 topic_id: 33993 reply_id: 135212[/import]

Hey, @richard9 -
This isn’t the CBEffects forum page, but here’s how:
[lua]local CBObject = CBE.new{
{
preset = “hyperspace”,
title=“ThisVent” – Give each a unique title
}
}
CBObject:start(“ThisVent”) – Call your previously named vent
–OR
–CBObject:startMaster() – Starts all vents inside of the CBObject, regardless of title.[/lua]

Caleb [import]uid: 147322 topic_id: 33993 reply_id: 135232[/import]

Caleb: :stuck_out_tongue: I just wanted something to test your issue with. (Though my post works just as well at telling you I failed your PDF guide test :wink:

Alright, so here’s the sample code I used. Dirt simple as all bug testing code should be.

[code]–main.lua
– Testing whether CBEffects works from a folder via a storyboard scene.
local storyboard = require(“storyboard”)
storyboard.gotoScene(“example”)

– example.lua
local CBE = require(“CBEffects.Library”)
local storyboard = require(“storyboard”)
local scene = storyboard.newScene()

function scene:createScene(event)
local CBObject = CBE.new{
{
preset = “hyperspace”,
}
}

CBObject:startMaster()
end

scene:addEventListener( “createScene”, scene )

return scene[/code]

Results :
* Simulator: Fine
* iPhone:Fine (and looks great btw!)

So realistically either
(a) these problem reports are due to some other bug and we can’t test for it unless they can give some sample code, or
(b) they have made a case typo somewhere (a common problem when requiring in files and folders with mixed case names) and don’t realize that (AFAIK) those problems aren’t reported by Corona during the build process. [import]uid: 41884 topic_id: 33993 reply_id: 135258[/import]

By any chance, would this problem be occurring because I don’t have the “module()” function at the top of the helper library? [import]uid: 147322 topic_id: 33993 reply_id: 135574[/import]

I don’t think so. module() was deprecated and was only used to basically turn requires into globals (sort of) anyway. If CBEffects.Library calls the other lua files, but the coder only calls CBEffects.Library, then you’re fine with local requires. [import]uid: 41884 topic_id: 33993 reply_id: 135655[/import]

By any chance, would this problem be occurring because I don’t have the “module()” function at the top of the helper library? [import]uid: 147322 topic_id: 33993 reply_id: 135574[/import]

I don’t think so. module() was deprecated and was only used to basically turn requires into globals (sort of) anyway. If CBEffects.Library calls the other lua files, but the coder only calls CBEffects.Library, then you’re fine with local requires. [import]uid: 41884 topic_id: 33993 reply_id: 135655[/import]