cnotethegr8
cnotethegr8

Reputation: 7510

Corona SDK call function from file inside a folder

Im using the Corona SDK.

Here is an example of my file directory...

- Project Folder
-- file.lua
-- Another Folder
--- another_file.lua 
-- main.lua

I just started using Corona 4 days ago, so let me know if i missed something in the explanation.

So now were in main.lua and im using newGroup() to display my content.

I want to call the new() function from file.lua so i write, localGroup:insert(file.new()). And this works great.

Now when i want to call the new() function from the another_file.lua, localGroup:insert(another_file.new()), i get an error.

It has something to do with the file being nested in another folder. How can I write this to make it work?

Upvotes: 0

Views: 1307

Answers (2)

Dejay Clayton
Dejay Clayton

Reputation: 3878

For iOS, this feature has been available since Corona SDK Build 2011.619:

http://blog.anscamobile.com/2011/10/daily-build-feature-lua-files-in-folders/

I expect this feature would come soon for Android.

Upvotes: 1

jester113
jester113

Reputation: 24

sorry, but you must put all your .lua files in the root directory where the main.lua is located, else you'll get errors. one of the drawbacks of corona is that you can only put images in subfolders, but other .lua files, movies, and sounds must be in the root directory. the reason your call to file.lua works (im assuming) is the fact that its in the root folder. try moving another_file.lua to the main and try making a call. it should work that way. ^^

Upvotes: 1

Related Questions