Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Need help with lua and luasql
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

Need help with lua and luasql

To make this short, I want to use mongoose web server (the MIT version: https://github.com/civetweb/civetweb ) with lua and with luasql library.

I can compile mongoose and lua easy but I have no clue how to compile luasql with it, I never compiled a lua module, and I do not even know if compiling luasql with lua and mongoose would be compatible. Has anyone done this?

Also most of the articles say "just use lua rocks" which I can't, since lua is compiled with mongoose (so its just one binary file).

Any help would be super appreciated.

Comments

  • It doesn't matter that lua is compiled with mongoose into a single binary.

    You can ask Lua to load a shared library or package with require or package.loadlib commands - after setting up the right path. In your case you would need to point it to where your files are available, typically your luarocks distribution.

    LuaRocks is just a package manager that puts its files in a nice directory hierarchy. In my case, LuaRocks is installed under /usr/local/lib/luarocks/rocks. For examples on loading libraries take a look at Trepl's Init. It has a custom require function that loads up its requirements. Search for uses of require, package.config and package.loadlib.

    You could have a difficult time with Lua if you don't have a fair deal of experience with C.

  • Looking in the Makefile, could you not compile using WITH_LUA_SHARED=1 instead of WITH_LUA=1? You should then be able to install/compile Lua seperately from Civetweb and luarocks should not be a problem.

  • @rincewind
    Sadly C is my weak point, and of course I knew about lua require but I guess civetweb/mongoose was updated to support lua ether compiled with it or shared (which I did not know till now.)

    @r0t3n
    I am truly sorry as stated a bit above I have used mongoose/civetweb about a year ago, and loading other modules was not possible at that time so this opens up alot for me :-)

    You guys made my day since I did not know I could now use lua as shared, this is great.

Sign In or Register to comment.