Problem with dot syntax as path separator with require

I have the following code:

   local path

   if display.contentScaleY == 2 then 

      path = “assets.intro-ready.retina.”

   else

      path = “assets.intro-ready.regular.”

   end

   

   local introLogoSheetInfo = require(path…“logo.logo”)

   

Under simulator it runs ok.

Under coronacards on iOS, I get this runtime error:

2015-02-02 23:38:16.710 Cucubes[92950:9454987] Platform: iPad Simulator / x86_64 / 8.1 / Apple Software Renderer / OpenGL ES 2.0 APPLE-10.1.5 / 2014.2511

2015-02-02 23:38:16.869 Cucubes[92950:9454987] Runtime error

module ‘assets.intro-ready.regular.logo.logo’ not found:

no field package.preload[‘assets.intro-ready.regular.logo.logo’]

no file ‘/Users/max/Library/Developer/CoreSimulator/Devices/2DAAE2FF-5D38-4111-A15A-F8AC61A916D8/data/Containers/Bundle/Application/DCE1A988-991A-4BF5-ADDC-62594A3BC303/Cucubes.app/assets.intro-ready.regular.logo.logo.lua’

no file ‘/Users/max/Library/Developer/CoreSimulator/Devices/2DAAE2FF-5D38-4111-A15A-F8AC61A916D8/data/Containers/Bundle/Application/DCE1A988-991A-4BF5-ADDC-62594A3BC303/Cucubes.app/assets.intro-ready.regular.logo.logo.lua’

no file ‘./assets.intro-ready.regular.logo.logo.so’

no file ‘/Users/max/Library/Developer/CoreSimulator/Devices/2DAAE2FF-5D38-4111-A15A-F8AC61A916D8/data/Containers/Bundle/Application/DCE1A988-991A-4BF5-ADDC-62594A3BC303/Cucubes.app/assets.intro-ready.regular.logo.logo.so’

no file ‘./assets.so’

no file '/Users/max/Library/Developer/CoreSimulator/Devices/2DAAE2FF-5D38-4111-A15A-F8AC61A916D8/data/Containers/Bundle/Application/DCE1A988-991A-4BF5-ADDC-62594A3BC303/Cucubes.app/assets.so’assets.intro-ready.regular.logo.logo

stack traceback:

[C]: in function ‘require’

?: in function ‘require’

As we can see, it does not translate dots to slashes.

I have tried to replace dots with slashes in lua code, and got this:

2015-02-03 00:00:37.173 Cucubes[93028:9464276] Runtime error

Error calling ‘require(“assets/intro-ready/regular/logo/logo”)’. Lua requires package names to use ‘.’ as path separators, not ‘/’. Replace the ‘/’ characters with ‘.’ and try again.

So, how do I fix it?

Thank you, Denis

Help, please, anyone?

Anyone from Corona Labs, please at least acknowledge you’ve read this??

I can’t speak for CoronaCards as I don’t use it myself, but one thing is:

If it works in the Corona Simulator, but not on device (or Xcode simulator), it’s usually a case issue with your files. iOS is case sensitive so make sure your actual filenames have exactly the same case as you have typed in your code.

Ingemar, thanks for the response. 

Unfortunately, this is not the case. The filename is: ./assets/intro-ready/regular/logo/logo.lua

The path in the require call: 

path = “assets.intro-ready.regular.”

local introLogoSheetInfo = require(path…“logo.logo”)

As you can see, everything is lowercase.

Also, in the log, you see the exact path it is trying to load:

no file ‘/Users/max/Library/Developer/CoreSimulator/Devices/2DAAE2FF-5D38-4111-A15A-F8AC61A916D8/data/Containers/Bundle/Application/DCE1A988-991A-4BF5-ADDC-62594A3BC303/Cucubes.app/assets.intro-ready.regular.logo.logo.lua’

See how it didn’t replace the dots with slashes for that part? 

It looks almost like CoronaCards has difficulty with subfolders for some reason.

Unfortunately I don’t use CoronaCards, so I can’t check any further. Sorry about that.

Hopefully somebody that knows more about CoronaCards can help you.

Hi there,

Apologies for the late response.

We are currently addressing the same issue with CoronaCards on Android.

We’ll begin looking into the issue on iOS as well.

Thanks.

Help, please, anyone?

Anyone from Corona Labs, please at least acknowledge you’ve read this??

I can’t speak for CoronaCards as I don’t use it myself, but one thing is:

If it works in the Corona Simulator, but not on device (or Xcode simulator), it’s usually a case issue with your files. iOS is case sensitive so make sure your actual filenames have exactly the same case as you have typed in your code.

Ingemar, thanks for the response. 

Unfortunately, this is not the case. The filename is: ./assets/intro-ready/regular/logo/logo.lua

The path in the require call: 

path = “assets.intro-ready.regular.”

local introLogoSheetInfo = require(path…“logo.logo”)

As you can see, everything is lowercase.

Also, in the log, you see the exact path it is trying to load:

no file ‘/Users/max/Library/Developer/CoreSimulator/Devices/2DAAE2FF-5D38-4111-A15A-F8AC61A916D8/data/Containers/Bundle/Application/DCE1A988-991A-4BF5-ADDC-62594A3BC303/Cucubes.app/assets.intro-ready.regular.logo.logo.lua’

See how it didn’t replace the dots with slashes for that part? 

It looks almost like CoronaCards has difficulty with subfolders for some reason.

Unfortunately I don’t use CoronaCards, so I can’t check any further. Sorry about that.

Hopefully somebody that knows more about CoronaCards can help you.

Hi there,

Apologies for the late response.

We are currently addressing the same issue with CoronaCards on Android.

We’ll begin looking into the issue on iOS as well.

Thanks.