author | francesco-ST <francesco.abbate@st.com> | 2010年08月04日 15:26:20 +0200 |
---|---|---|
committer | francesco-ST <francesco.abbate@st.com> | 2010年08月04日 15:26:20 +0200 |
commit | 544643a77a901bc27fc17b7756764c1cb8ccc2a8 (patch) | |
tree | 246e1d2896b984ea9dab3b233fcf801935edc71e /window-refs.c | |
parent | f145fa7be5615ac2ffc15f5859e1c9290ba5b9e3 (diff) | |
download | gsl-shell-544643a77a901bc27fc17b7756764c1cb8ccc2a8.tar.gz |
-rw-r--r-- | window-refs.c | 19 |
diff --git a/window-refs.c b/window-refs.c index 4cbfa1d3..0d1c40cb 100644 --- a/window-refs.c +++ b/window-refs.c @@ -3,6 +3,7 @@ #include <lauxlib.h> #include "window-refs.h" +#include "canvas-window.h" static char const * const window_ref_table_name = "GSL.windows"; @@ -30,10 +31,26 @@ window_ref_add(lua_State *L, int index) } void -window_ref_remove(lua_State *L, int id) +window_ref_remove (lua_State *L, int id) { lua_getfield (L, LUA_REGISTRYINDEX, window_ref_table_name); lua_pushnil (L); lua_rawseti (L, -2, id); lua_pop (L, 1); } + +void +window_ref_close_all (lua_State *L) +{ + lua_getfield (L, LUA_REGISTRYINDEX, window_ref_table_name); + + lua_pushnil (L); /* first key */ + while (lua_next(L, -2) != 0) + { + lua_pushcfunction (L, canvas_window_close); + lua_insert (L, -2); + lua_call (L, 1, 0); + } + + lua_pop (L, 1); +} |