Problem loading modules

Hi, since today i’m getting a weird error while loading modules. I’ve been using last public build (1076), I’ve tried installing the last daily build, resetting my pc, nothing seems to fix it.

Im getting this while trying to load “main.lua”. From time to time I get an error on some projects, it looks like it’s trying to load “x.lu” instead of “x.lua”, well at least the errors says so.

But now, if i create a folder called Plugins inside Corona’s simulator folder and put “main.lua” inside it, i get NO error. That was with 1076 build, now i get a different error but putting the file in that path works. 

Anyone know how to fix it? It totally looks like a corona error.

Windows simulator build date: May 14 2013 @ 02:41:02

Copyright © 2009-2013  C o r o n a   L a b s   I n c .

        Version: 2.0.0

        Build: 2013.1107

Runtime error

module ‘menu’ not found:resource (menu.lu) does not exist in archive

        no field package.preload[‘menu’]

        no file 'C:\Users\NH\AppData\Roaming\Corona Labs\Corona Simulator\fPlugi

nsPaths\menu.lua’

        no file 'c:\users\nh\desktop\stuff corona\C:\

The error message for missing modules has always missed out the ‘a’ in ‘Lua’ for as long as I can remember, so it’s definitely not trying to load a file called x.lu 

Without a bit more info, I’m not sure I can diagnose the problem though. You said “Im getting this while trying to load main.lua”, but your error code says “module ‘menu’ not found”. My guess would be that your menu.lua code has an error in it somewhere which is preventing it from being loaded, but at the moment that is just a guess.

It does look strange that it’s looking for menu.lua in the PluginPaths folder though.

Sorry, i’m trying to load “menu.lua”, it was a typo. Yes, as far as i know the “.lu” typo was present since at least build 500+, but i find really weird that the sim is trying to search my modules in that path. Build 1076 was trying to find it in “C:\Program Files(x86)\Corona Labs\Corona SDK\Plugins”, and same thing happened, if i create the folder and put menu.lua there, it works.

Any ideas?

It looks like you have directories with spaces in the name. For example:

Corona Labs

Corona Simulator

stuff corona

I find that having spaces or other special characters in directory names can cause problems. Try putting your files somewhere that doesn’t have any spaces in the directory name and see if this problem goes away.

Hi @undecode,

The error you’re getting is (almost certainly) because Corona can’t find the module you want to require. This is likely a path specification issue in your code, or how you typed the file name. As the others suggest, try removing the spaces in the directory names, check that the cases match, etc.

Please give this document a review, if you haven’t already…

http://docs.coronalabs.com/api/library/package/require.html

Finally, remember that when requiring modules in subdirectories, you don’t use “/”, but rather “dot” notation:

[lua]

local myModule = require ( “subdirectory.subsubdirectory.myModule” )

[/lua]

Regards,

Brent Sorrentino

The error message for missing modules has always missed out the ‘a’ in ‘Lua’ for as long as I can remember, so it’s definitely not trying to load a file called x.lu 

Without a bit more info, I’m not sure I can diagnose the problem though. You said “Im getting this while trying to load main.lua”, but your error code says “module ‘menu’ not found”. My guess would be that your menu.lua code has an error in it somewhere which is preventing it from being loaded, but at the moment that is just a guess.

It does look strange that it’s looking for menu.lua in the PluginPaths folder though.

Sorry, i’m trying to load “menu.lua”, it was a typo. Yes, as far as i know the “.lu” typo was present since at least build 500+, but i find really weird that the sim is trying to search my modules in that path. Build 1076 was trying to find it in “C:\Program Files(x86)\Corona Labs\Corona SDK\Plugins”, and same thing happened, if i create the folder and put menu.lua there, it works.

Any ideas?

It looks like you have directories with spaces in the name. For example:

Corona Labs

Corona Simulator

stuff corona

I find that having spaces or other special characters in directory names can cause problems. Try putting your files somewhere that doesn’t have any spaces in the directory name and see if this problem goes away.

Hi @undecode,

The error you’re getting is (almost certainly) because Corona can’t find the module you want to require. This is likely a path specification issue in your code, or how you typed the file name. As the others suggest, try removing the spaces in the directory names, check that the cases match, etc.

Please give this document a review, if you haven’t already…

http://docs.coronalabs.com/api/library/package/require.html

Finally, remember that when requiring modules in subdirectories, you don’t use “/”, but rather “dot” notation:

[lua]

local myModule = require ( “subdirectory.subsubdirectory.myModule” )

[/lua]

Regards,

Brent Sorrentino

Also, underscores in module names appear to break Enterprise as well.

Also, underscores in module names appear to break Enterprise as well.