author | francesco-ST <francesco.abbate@st.com> | 2010年08月25日 15:49:10 +0200 |
---|---|---|
committer | francesco-ST <francesco.abbate@st.com> | 2010年08月25日 15:49:10 +0200 |
commit | 57eff12fb29f77f919d12de2550d5e1484c4ff4a (patch) | |
tree | cfb418cbe90d12a698b0ec7d4b5f7e0a13cd592f /win-plot-refs.c | |
parent | 29a9dbd5af79c3c80749efaf09fb8240482ff5b5 (diff) | |
download | gsl-shell-57eff12fb29f77f919d12de2550d5e1484c4ff4a.tar.gz |
-rw-r--r-- | win-plot-refs.c | 30 |
diff --git a/win-plot-refs.c b/win-plot-refs.c index 3dbd4dd9..bd7a642a 100644 --- a/win-plot-refs.c +++ b/win-plot-refs.c @@ -60,3 +60,33 @@ window_plot_ref_remove (lua_State *L, int slot_id, int window_index) lua_pop (L, 2); } + +void +window_plot_rev_lookup_apply (lua_State *L, int plot_index, lua_CFunction func) +{ + INDEX_SET_ABS(L, plot_index); + + lua_getfield (L, LUA_REGISTRYINDEX, window_plot_ref_table_name); + lua_pushnil (L); + + while (lua_next (L, -2) != 0) + { + lua_pushnil (L); + + while (lua_next (L, -2) != 0) + { + if (lua_rawequal (L, -1, plot_index)) + { + lua_pushcfunction (L, func); + lua_pushvalue (L, -5); + lua_pushvalue (L, -4); + lua_call (L, 2, 0); + } + lua_pop (L, 1); + } + + lua_pop (L, 1); + } + + lua_pop (L, 1); +} |