Corona SDK breaks luasockets on Lua 5.2 ?

have an install of Lua 5.2  I find that after installing Corona SDK Lua 5.2 can no longer require(‘sockets’).  It fails when sockets requires sockets/core.

What I find is LUA_PATH and therefor package.path have been redefined to:

/Applications/CoronaSDK/Corona Simulator.app/Contents/Resources/?.lua;/Applications/CoronaSDK/Corona Simulator.app/Contents/Resources/?.lua;

I don’t understand how this was done since it is not added to my .bash_profile

How can the LUA_PATH be changed without changing .bash_profile?

Is it possible to have 5.2 and the Corona simulator installed simultaneously?

Further on this issue:

Inside 5.2 package.cpath is also changed apparently because there is a new environmental variable LUA_CPATH: 

./?.dylib;/Applications/CoronaSDK/Corona Simulator.app/Contents/Resources/?.dylib;

This path template will not find sockets/core.co so luasockets will not load.

Whenever I open a Terminal window on OSX to start the Lua 5.2 interpreter I find that the environmental variable LUA_CPATH has been added with the string above.  What I dont understand it how installing Corona SDK did this since it did not change .bash_profile.  WHere does the installer reach to add an environmental variable without changing .bash_profile?

I have a partial reply to my own question.  Apparently opening a new window in OSX Terminal.app does not run .bash_profile again but gives a copy of the existing environment.  When Corona emulator is started it opens terminal to create its console and must modify the environment.  If another window is opened it sees the same environment and since there is a new LUA_CPATH lua in that window  cannot find luasockets.

The workaround is to close everything including the emulator and terminal.app and then restart terminal.app to use Lua 5.2.

This means that Corona and 5.2 can both be installed at once but not used at once although I dont see a reason that would be necessary.

I believe Corona SDK is using 5.1.5.  Your use of Lua outside of Corona SDK is it’s own standalone version.

Further on this issue:

Inside 5.2 package.cpath is also changed apparently because there is a new environmental variable LUA_CPATH: 

./?.dylib;/Applications/CoronaSDK/Corona Simulator.app/Contents/Resources/?.dylib;

This path template will not find sockets/core.co so luasockets will not load.

Whenever I open a Terminal window on OSX to start the Lua 5.2 interpreter I find that the environmental variable LUA_CPATH has been added with the string above.  What I dont understand it how installing Corona SDK did this since it did not change .bash_profile.  WHere does the installer reach to add an environmental variable without changing .bash_profile?

I have a partial reply to my own question.  Apparently opening a new window in OSX Terminal.app does not run .bash_profile again but gives a copy of the existing environment.  When Corona emulator is started it opens terminal to create its console and must modify the environment.  If another window is opened it sees the same environment and since there is a new LUA_CPATH lua in that window  cannot find luasockets.

The workaround is to close everything including the emulator and terminal.app and then restart terminal.app to use Lua 5.2.

This means that Corona and 5.2 can both be installed at once but not used at once although I dont see a reason that would be necessary.

I believe Corona SDK is using 5.1.5.  Your use of Lua outside of Corona SDK is it’s own standalone version.