From 0103cd7eefa668a02e3ab4349a36c1bd8f2a42bb Mon Sep 17 00:00:00 2001 From: Francesco Abbate Date: 2012年8月21日 13:38:10 +0200 Subject: Implement a simpler way to lookup for methods and properties Remove also a lot of no longer used code in lua-utils.c. --- agg-plot/lua-plot.cpp | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) (limited to 'agg-plot/lua-plot.cpp') diff --git a/agg-plot/lua-plot.cpp b/agg-plot/lua-plot.cpp index 9812668b..f5f13f4f 100644 --- a/agg-plot/lua-plot.cpp +++ b/agg-plot/lua-plot.cpp @@ -30,7 +30,7 @@ extern "C" { #include "window.h" #include "window-cpp.h" #include "gs-types.h" -#include "lua-utils.h" +#include "lua-properties.h" #include "window_registry.h" #include "lua-cpp-utils.h" #include "lua-draw.h" @@ -46,8 +46,6 @@ static int plot_add (lua_State *L); static int plot_update (lua_State *L); static int plot_flush (lua_State *L); static int plot_add_line (lua_State *L); -static int plot_index (lua_State *L); -static int plot_newindex (lua_State *L); static int plot_free (lua_State *L); static int plot_show (lua_State *L); static int plot_title_set (lua_State *L); @@ -92,8 +90,6 @@ static const struct luaL_Reg plot_functions[] = { }; static const struct luaL_Reg plot_metatable[] = { - {"__index", plot_index }, - {"__newindex", plot_newindex }, {"__gc", plot_free }, {NULL, NULL} }; @@ -471,20 +467,6 @@ plot_units_get (lua_State *L) return plot_bool_property_get(L, &sg_plot::use_units); } -int -plot_index (lua_State *L) -{ - return mlua_index_with_properties (L, - plot_properties_get, - plot_methods, false); -} - -int -plot_newindex (lua_State *L) -{ - return mlua_newindex_with_properties (L, plot_properties_set); -} - void plot_update_raw (lua_State *L, sg_plot *p, int plot_index) { @@ -790,6 +772,7 @@ plot_register (lua_State *L) { /* plot declaration */ luaL_newmetatable (L, GS_METATABLE(GS_PLOT)); + register_properties_index(L, plot_methods, plot_properties_get, plot_properties_set); luaL_register (L, NULL, plot_metatable); lua_pop (L, 1); -- cgit v1.2.3

AltStyle によって変換されたページ (->オリジナル) /