Add display.top_canvas & bottom_canvas interface.
authorGuo Rui <firemeteor@Adam.(none)>
Thu, 16 Jul 2009 15:01:39 +0000 (16 23:01 +0800)
committerGuo Rui <firemeteor@Adam.(none)>
Thu, 16 Jul 2009 15:01:39 +0000 (16 23:01 +0800)
src/lua.c

index 3aa7d0b..81197c9 100644 (file)
--- a/src/lua.c
+++ b/src/lua.c
@@ -768,8 +768,34 @@ display_get_canvases(lua_State *L)
   return 1;
 }
 
+static int
+display_top_canvas(lua_State *L)
+{
+  struct display *d;
+  d = check_display(L, 1);
+  push_canvas(L, &d->d_cvlist);
+
+  return 1;
+}
+
+static int
+display_bot_canvas(lua_State *L)
+{
+  struct display *d;
+  struct canvas *c;
+  d = check_display(L, 1);
+  
+  for (c = d->d_cvlist; c->c_next; c = c->c_next)
+    ;
+  push_canvas(L, &c);
+
+  return 1;
+}
+
 static const luaL_reg display_methods[] = {
   {"get_canvases", display_get_canvases},
+  {"top_canvas", display_top_canvas},
+  {"bottom_canvas", display_bot_canvas},
   {0, 0}
 };