From 6e35e5b6e2335026cc13471d95829eaf124c2ba4 Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Fri, 18 Apr 2014 14:14:36 +1000 Subject: Move clear() and quit() to GuiLua.c, and actually implement quit(). --- ClientHamr/GuiLua/GuiLua.c | 29 ++++++++++++++++++++++++++--- ClientHamr/GuiLua/skang.lua | 12 +----------- 2 files changed, 27 insertions(+), 14 deletions(-) (limited to 'ClientHamr') diff --git a/ClientHamr/GuiLua/GuiLua.c b/ClientHamr/GuiLua/GuiLua.c index 9ef60de..27e01d7 100644 --- a/ClientHamr/GuiLua/GuiLua.c +++ b/ClientHamr/GuiLua/GuiLua.c @@ -558,6 +558,13 @@ static int window(lua_State *L) return 0; } +static int clear(lua_State *L) +{ +// TODO - This is just a stub for now. + + return 0; +} + static int loopWindow(lua_State *L) { globals *ourGlobals; @@ -572,6 +579,19 @@ static int loopWindow(lua_State *L) return 0; } +static int quit(lua_State *L) +{ + globals *ourGlobals; + + lua_getfield(L, LUA_REGISTRYINDEX, globName); + ourGlobals = lua_touserdata(L, -1); + lua_pop(L, 1); + + _on_done(ourGlobals, NULL, NULL); + + return 0; +} + static int closeWindow(lua_State *L) { globals *ourGlobals; @@ -644,9 +664,12 @@ int luaopen_libGuiLua(lua_State *L) skang = lua_gettop(L); // Define our functions. - push_lua(L, "@ ( = $ $ & $ )", skang, THINGASM, skang, "window", "Opens our window.", window, "number,number,string", 0); - push_lua(L, "@ ( = $ $ & )", skang, THINGASM, skang, "loopWindow", "Run our windows main loop.", loopWindow, 0); - push_lua(L, "@ ( = $ $ & )", skang, THINGASM, skang, "closeWindow", "Closes our window.", closeWindow, 0); +//thingasm{'window', 'The size and title of the application Frame.', window, 'x,y,name', acl='GGG'} + push_lua(L, "@ ( { = $ $ & $ $acl } )", skang, THINGASM, skang, "window", "Opens our window.", window, "number,number,string", "GGG", 0); + push_lua(L, "@ ( = $ $ & )", skang, THINGASM, skang, "clear", "The current skin is cleared of all widgets", clear, 0); + push_lua(L, "@ ( = $ $ & )", skang, THINGASM, skang, "loopWindow", "Run our windows main loop.", loopWindow, 0); + push_lua(L, "@ ( = $ $ & )", skang, THINGASM, skang, "quit", "Quit, exit, remove thyself.", quit, 0); + push_lua(L, "@ ( = $ $ & )", skang, THINGASM, skang, "closeWindow", "Closes our window.", closeWindow, 0); // A test of the array building stuff. push_lua(L, "@ ( { = $ $ % $widget !required } )", skang, THINGASM, skang, "wibble", "It's wibbly!", 1, "'edit', 'The wibblinator:', 1, 1, 10, 50", 1, 0); diff --git a/ClientHamr/GuiLua/skang.lua b/ClientHamr/GuiLua/skang.lua index 5dbf36f..8a882d2 100644 --- a/ClientHamr/GuiLua/skang.lua +++ b/ClientHamr/GuiLua/skang.lua @@ -991,21 +991,11 @@ thingasm('set', 'Set the current value of an existing Thing or metadata.', set, thingasm('nada', 'Do nothing.', function () --[[ This function intentionally left blank. ]] end) --- TODO - Some function stubs, for now. Fill them up later. Probably move the lot to GuiLua.c. -clear = function () -end - +-- TODO - Some function stubs, for now. Fill them up later. skang = function (name) end -quit = function () -end -thingasm('clear', 'The current skin is cleared of all widgets.', clear) thingasm('skang', 'Parse the contents of a skang file or URL.', skang, 'URL') -thingasm('quit', 'Quit, exit, remove thyself.', quit) - --- TODO - This moved to the GuiLua.c, but it's not all there yet. ---thingasm{'window', 'The size and title of the application Frame.', window, 'x,y,name', acl='GGG'} moduleEnd(_M) -- cgit v1.1