lua-users home
lua-l archive

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


Hi,

Mildred yazmış:
Hi,

I wanted to program GUIs in lua so I installed wxLua. But I don't
understand how to use it from a normal lua interpreter.
the statement require("wx") makes an error since require can't find any
wxLua library. Apparently, I have to use the wxLua program.

So, does anyone know how to require wxLua from a normal lua
interpreter ... or how to make a .so that can perform that ?
Thanks.

Mildred


I think You can't use wxLua as -standard- Lua binary module, yet.

But it is possible to use it as a dll.
(With the samples for 'using wx as plugin')
I did some experiment. Usage is like this:


[test.lua]
dofile("./samples/wxluasudoku.wx.lua")
wx.wxGetBaseApp():SetExitOnFrameDelete(true)
wx.wxGetBaseApp():MainLoop()


test.lua is executed by a loader program:

[test.cpp]
#include <windows.h>
typedef int (__stdcall *TRunScript)(const char* script);
TRunScript RunScript;

int main()
{
    HINSTANCE handle = LoadLibrary("wxlua_ds.dll");
    if (!handle) return -33;
    RunScript = (TRunScript)GetProcAddress(handle, "RunScript");

    int rc = RunScript("test.lua");

    return rc;
}


Of course, You can use Lua binary modules in test.lua.

If you are interested I can make it available for download.


--
Regards,
Hakki Dogusan