[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: [Fwd: Re: ngui 0.01]
- From: Hakki Dogusan <dogusanh@...>
- Date: Thu, 30 Nov 2006 17:26:54 +0200
Hi,
(Sorry, if you get it twice.)
-------- Orijinal Mesaj --------
Konu: Re: ngui 0.01
Tarih: Wed, 29 Nov 2006 23:22:16 +0200
Hi,
Noel Frankinet wrote:
Do you plan to implement ngui as "ordinary" lua module?
ie.
require "ngui"
I think it should work, just need a small lua script to do the real
"loadlib"
g = ngui.LuaGlob()
f=g:Form({title="hello",ok=1,cancel=1,margin=5,tab={"un","deux","trois"}})
...
g:run() --etc for message loop
good idea, however, I suppose that most of the time, ngui will be loaded
from a program that already has a message pump, but I may be wrong.
Best regards
What about running a ngui script via lua.exe ?
I believe ngui as lua module would open new ways to use it.
Folowing is an example using wxLua. There is no message loop
there. All gui is handled in script. This program just starts it:
#include <windows.h>
extern "C"
{
#include <lua.h>
#include <lauxlib.h>
#include <lualib.h>
}
//from lua.c
static int report (lua_State *L, int status) {
if (status && !lua_isnil(L, -1)) {
const char *msg = lua_tostring(L, -1);
if (msg == NULL) msg = "(error object is not a string)";
MessageBox(NULL, msg, NULL, 0); //l_message(progname, msg);
lua_pop(L, 1);
}
return status;
}
int WINAPI WinMain (HINSTANCE hThisInstance,
HINSTANCE hPrevInstance,
LPSTR lpszArgument,
int nCmdShow)
{
lua_State* L = lua_open();
if (!L)
{
MessageBox(NULL, "Could not open Lua", NULL, 0);
return 0;
}
luaL_openlibs(L); // open std libraries
int rc = luaL_loadfile(L, "./bbsc.lua") || // parse ok?
lua_pcall(L, 0, LUA_MULTRET, 0); // call main
report(L, rc);
lua_close(L);
return rc;
}
--
Regards,
Hakki Dogusan