author | Francesco Abbate <francesco.bbt@gmail.com> | 2012年03月29日 17:23:35 +0200 |
---|---|---|
committer | Francesco Abbate <francesco.bbt@gmail.com> | 2012年04月01日 22:57:19 +0200 |
commit | 5c80bf0af85627c0e62d0f097e9ed6679f6bed73 (patch) | |
tree | 53c88940049bef966c8994cf59f831c26061a8c2 /agg-plot/window.cpp | |
parent | e255825367665691584ae44755df5f2882a25c66 (diff) | |
download | gsl-shell-5c80bf0af85627c0e62d0f097e9ed6679f6bed73.tar.gz |
-rw-r--r-- | agg-plot/window.cpp | 9 |
diff --git a/agg-plot/window.cpp b/agg-plot/window.cpp index 4a412b7b..f48a725c 100644 --- a/agg-plot/window.cpp +++ b/agg-plot/window.cpp @@ -423,7 +423,14 @@ void window::start (lua_State *L, gslshell::ret_status& st) int window_new (lua_State *L) { - window *win = push_new_object<window>(L, GS_WINDOW, colors::white); + lua_getfield(L, LUA_REGISTRYINDEX, "__gsl_shell"); + gsl_shell_state* gs = (gsl_shell_state*) lua_touserdata(L, -1); + lua_pop(L, 1); + + if (unlikely(gs == NULL)) + return luaL_error(L, "cannot create window: not a GSL Shell state"); + + window *win = push_new_object<window>(L, GS_WINDOW, gs); const char *spec = lua_tostring (L, 1); gslshell::ret_status st; |