lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hello, first post to the list.

I became aware of Lua because Gnugk has a module which permits to use lua scripts as the logic for routing h.323 calls https://www.gnugk.org/gnugk-manual-6.html#ss6.16

I experimented a little bit and Lua scripts works ok within Gnugk except from when I try to load the luasql module to connect to a mysql database; in that case I get the following error  in Gnugk Logs "lua.cxx(129)   LUA Error in LUA script: error loading module 'luasql. /usr/local/lib/lua/5.3/luasql/mysql.so: undefined symbol: lua_settop"

Given that I don't have such an issue when I use the interpreter, I ended up thinking that that error is caused by mysql.so library being compiled as C while lua being compiled within GnuGk as C++ (what helped me with this was this page https://stackoverflow.com/questions/32491131/how-to-fix-this-error-i-get-while-attempting-to-execute-a-lua-file-via-c and realizing that lua headers in GnuGk are included as an extern "C" block, see https://github.com/willamowius/gnugk/blob/master/lua.cxx at line 31).

Is my reasoning correct? If so, is there a way of doing things so that I can directly use the external library within embedded lua? 

At the moment I am using os.execute from the "embedded" script to have the lua interpreter execute another lua script that connects to the db and reading the output of such script from a temp file.

Any suggestions? 

Thanks,
pierlu