Where is CCFileUtils in Lua?

I know it’s been another year but I am struggling with this too, using the iOS simulator. I want to put Lua files in a subdirectory lua, and still be able to require them.

Before I do anything, the package path is:

./?.lua;/usr/local/share/luajit-2.0.1/?.lua;/usr/local/share/lua/5.1/?.lua;/usr/local/share/lua/5.1/?/init.lua

Normally, I’d expect to be able to prepend ./lua/?.lua; to the package.path to make this work. But that doesn’t seem to work, it doesn’t find the module.

module 'aux' not found:
    no field package.preload['aux']aux
    no file './lua/aux.lua'
    no file './aux.lua'
    no file '/usr/local/share/luajit-2.0.1/aux.lua'
    no file '/usr/local/share/lua/5.1/aux.lua'
    no file '/usr/local/share/lua/5.1/aux/init.lua'
    no file './aux.so'
    no file '/usr/local/lib/lua/5.1/aux.so'
    no file '/usr/local/lib/lua/5.1/loadall.so

So to be clear, at this point require ‘aux’ would find it in ./aux.lua (as Resources/aux.lua) but not in ./lua/aux.lua (as Resources/lua/aux.lua). So obviously something is amiss.

If I try the suggestion of addSearchPath, in C++, with the idea that technique does extra magic:

    std::string paths = CCFileUtils::sharedFileUtils()->fullPathForFilename("lua");
    pEngine->addSearchPath(paths.c_str());

I can see this has two effects. First, it appends ;/Users/mlepage/Library/Application Support/iPhone Simulator/6.1/Applications/7F205B66-963D-4217-88EE-EB4A5FFCEF72/my.app/lua/?.lua to the package.path. Second, it seems to find the module file to load.

And it does seem to load the file. I can access its contents.

But I get this on the error console:

Cocos2d: Get data from file(aux.lua) failed!
Cocos2d: can not get file data of aux.lua

What does that mean?