Murga-Projects Forums

Full Version: Adding a Package
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I found the lua documentation on adding a package to be confusing. luarocks got me even more confused. Adding mysql support to murgalua on windows turned out to be simple.

Downloaded the binary package http://luaforge.net/frs/download.php/268...-lua51.zip
and extracted the mysql.dll to subdirectory \luasql. I also had to find and download libmysql.dll and put it into my current directory.

Then used

Code:
require("luasql.mysql")


to load the module.

It would be a good idea to include a few examples of this kind of thing in the murgalua documentation. It would also cut down on the number of requests to have additional packages added to the standard murgalua distribution.

Hi,

Thanks for the post.

It is funny you should say that ...

I was thinking about this as I put the finishing touches on 0.6.8 (which justifies a higher version number).

0.6.8 includes the "luacom" module for Windows with examplea of this kind of use of an external module.

And I'll push the Wiki out this week to allow people put up such examples.

Cheers
John de Murga
Thanks John. One of the nice things about PuppyLinux is how people can easily package their own flavor. It'd be really cool if there was a murgalua installer program that would ask a few simple questions then fetch what's needed, unzip it and put it all in the right place.
Unfortunately such a feature would probably be useful only to Windows users. I have yet to find a precompiled Lua module for Linux (at least one that would work for a decent number of distros...not just the one for which it was compiled).
Sometimes I wonder why people use Windows when Linux is free and has to some degree all of the same features. Then someone like mikshaw comes along and straightens me out.

The lua all in one project (luaaio) would seem to have some synergies with a murgalua packaging project. They recently released their first linux package which has mysql.so and a bunch of other xxxxx.so modules. I guess you'd still need to make sure there is a compatible libmysql.so.xx.

Quote:
Adding mysql support to murgalua on windows turned out to be simple.

Downloaded the binary package and extracted the mysql.dll to subdirectory \luasql. I also had to find and download libmysql.dll and put it into my current directory.

Then used require("luasql.mysql")

to load the module


trying this with murgalua v 0.6.4 on my winXP PC, i also had to put lua5.1.dll and msvcr80.dll in the bin directory. the first lua5.1.dll downloaded was not the good one and launching lua script with require("luasql.mysql") gave me the error message here attached. using lua5.1.dll and msvcr80.dll from luabinaries solved this problem:
lua binaries

briss Wrote:

Quote:
Adding mysql support to murgalua on windows turned out to be simple.

Downloaded the binary package and extracted the mysql.dll to subdirectory \luasql. I also had to find and download libmysql.dll and put it into my current directory.

Then used require("luasql.mysql")

to load the module


trying this with murgalua v 0.6.4 on my winXP PC, i also had to put lua5.1.dll and msvcr80.dll in the bin directory. the first lua5.1.dll downloaded was not the good one and launching lua script with require("luasql.mysql") gave me the error message here attached. using lua5.1.dll and msvcr80.dll from luabinaries solved this problem:
lua binaries


I am getting this same error. I believe I had luasql working correctly with murgalua prior to installing the latest 0.6.8 murgalua. I've got lua5.1.dll and msvcr80.dll out there.

I think you just copy lua5.1.dll in your directory without msvcr80.dll,
But make sure lua5.1.dll from lua-5.1.2 version.

It work with any murgaLua version, but i don't know why if i have more than one callback, example in button1 and button2 both have callback, causing problem (error in murgaLua.exe).

This is my script and error message in attachment, test.lua=
=====================================================
require "luasql.mysql"

function connection()
env = assert(luasql.mysql())
con = assert(env:connect ("mydb","root","superuseradmin","localhost","3306"))
str = "select 1 from dual"
q = assert(con:execute (str))
num = q:numrows()
msg:label(num)
q:close()
con:close()
env:close()
end

window = fltk:Fl_Double_Window(100, 100, 800, 600, "Test")
button1 = fltk:Fl_Button(10, 10, 150, 25, "Test Connection")
button1:callback(connection) -- <= callback 1
msg = fltk:Fl_Box(20, 10, 600, 25)
button2 = fltk:Fl_Button(10, 40, 150, 25, "Test Connection2")
button2:callback(connection) -- <= callback 2 cause error, if i remove this callback not causing error

window:show()
Fl:scheme("plastic")
Fl:run()
=====================================================

JohnM or everyone can help?
The screenshot is just a generic Windows error message and isn't very useful in diagnosing the specific trouble. The error report could have been more useful. If not, try running the application from within a cmd window and look at the output.

There should not be an issue with assigning the same callback to two different buttons. The only thing I can think of at the moment is that maybe you tested by pressing button1 and then pressing button2 while the callback was still running. That might cause a problem trying to open a file that is already opened. If button1 by itself works, button2 by itself should too.

I don't know diddly about the assert fuction, so for all know that might have something to do with it too.
I had a bitch of a time getting mysql to work with murgaLua. Scrounging around the internet, I finally found a DLL that seems to work. It dates back to early in 2006. You can download it here http://asafp.com/luamysql.dll

On Linux, I'm getting the following message:

error loading module 'mysql' from file './mysql.so':
./mysql.so: undefined symbol: lua_pushnil
Pages: 1 2
Reference URL's