summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--legacy/edje/src/examples/lua_script.edc2
-rw-r--r--legacy/edje/src/lib/edje_lua2.c53
2 files changed, 48 insertions, 7 deletions
diff --git a/legacy/edje/src/examples/lua_script.edc b/legacy/edje/src/examples/lua_script.edc
index d347e44e8a..4c61e430e7 100644
--- a/legacy/edje/src/examples/lua_script.edc
+++ b/legacy/edje/src/examples/lua_script.edc
@@ -90,7 +90,7 @@ collections {
90 end 90 end
91 91
92 local function mycb () 92 local function mycb ()
93 print("lua::callback " .. count .. " fndata = " .. fndata); 93 print("lua::callback timer " .. count .. " fndata = " .. fndata);
94 count = count + 1; --// keep count of calls - object data 94 count = count + 1; --// keep count of calls - object data
95 fndata = fndata + 3; --// play with object vars to see if they persist 95 fndata = fndata + 3; --// play with object vars to see if they persist
96 D.tim = edje.timer(0.25, mycb); --// inside cb add new timer 96 D.tim = edje.timer(0.25, mycb); --// inside cb add new timer
diff --git a/legacy/edje/src/lib/edje_lua2.c b/legacy/edje/src/lib/edje_lua2.c
index a55c189213..bb507d08f3 100644
--- a/legacy/edje/src/lib/edje_lua2.c
+++ b/legacy/edje/src/lib/edje_lua2.c
@@ -170,7 +170,8 @@ static const char *_elua_evas_line_meta = "evas_line_meta";
170static const char *_elua_evas_map_meta = "evas_map_meta"; 170static const char *_elua_evas_map_meta = "evas_map_meta";
171static const char *_elua_evas_polygon_meta = "evas_polygon_meta"; 171static const char *_elua_evas_polygon_meta = "evas_polygon_meta";
172static const char *_elua_evas_text_meta = "evas_text_meta"; 172static const char *_elua_evas_text_meta = "evas_text_meta";
173 173static const char *_elua_ecore_animator_meta = "ecore_animator_meta";
174static const char *_elua_ecore_timer_meta = "ecore_timer_meta";
174 175
175static int _elua_obj_gc(lua_State *L); 176static int _elua_obj_gc(lua_State *L);
176 177
@@ -1119,9 +1120,8 @@ _elua_animator(lua_State *L) // Stack usage [-?, +?, ?]
1119 1120
1120 luaL_checkany(L, 1); 1121 luaL_checkany(L, 1);
1121 1122
1122 // FIXME: This, and the other two timer thingies, should be it's own class, coz they are NOT evas objects. But that might be API change, so wait until after the freeze.
1123 // FIXME: Allow lua to set a data to be sent back with the callback. 1123 // FIXME: Allow lua to set a data to be sent back with the callback.
1124 ela = (Edje_Lua_Animator *)_elua_obj_new(L, ed, sizeof(Edje_Lua_Animator), _elua_evas_meta); 1124 ela = (Edje_Lua_Animator *)_elua_obj_new(L, ed, sizeof(Edje_Lua_Animator), _elua_ecore_animator_meta);
1125 ela->obj.free_func = _elua_animator_free; 1125 ela->obj.free_func = _elua_animator_free;
1126 ela->animator = ecore_animator_add(_elua_animator_cb, ela); 1126 ela->animator = ecore_animator_add(_elua_animator_cb, ela);
1127 lua_pushvalue(L, 1); 1127 lua_pushvalue(L, 1);
@@ -1205,7 +1205,7 @@ _elua_timer(lua_State *L) // Stack usage [-?, +?, ?]
1205 val = luaL_checknumber(L, 1); 1205 val = luaL_checknumber(L, 1);
1206 luaL_checkany(L, 2); 1206 luaL_checkany(L, 2);
1207 1207
1208 elt = (Edje_Lua_Timer *)_elua_obj_new(L, ed, sizeof(Edje_Lua_Timer), _elua_evas_meta); 1208 elt = (Edje_Lua_Timer *)_elua_obj_new(L, ed, sizeof(Edje_Lua_Timer), _elua_ecore_timer_meta);
1209 elt->obj.free_func = _elua_timer_free; 1209 elt->obj.free_func = _elua_timer_free;
1210 elt->timer = ecore_timer_add(val, _elua_timer_cb, elt); 1210 elt->timer = ecore_timer_add(val, _elua_timer_cb, elt);
1211 lua_pushvalue(L, 2); 1211 lua_pushvalue(L, 2);
@@ -1288,7 +1288,7 @@ _elua_transition(lua_State *L) // Stack usage [-?, +?, ?]
1288 val = luaL_checknumber(L, 1); 1288 val = luaL_checknumber(L, 1);
1289 luaL_checkany(L, 2); 1289 luaL_checkany(L, 2);
1290 1290
1291 elt = (Edje_Lua_Transition *)_elua_obj_new(L, ed, sizeof(Edje_Lua_Transition), _elua_evas_meta); 1291 elt = (Edje_Lua_Transition *)_elua_obj_new(L, ed, sizeof(Edje_Lua_Transition), _elua_ecore_animator_meta);
1292 elt->obj.free_func = _elua_transition_free; 1292 elt->obj.free_func = _elua_transition_free;
1293 elt->animator = ecore_animator_add(_elua_transition_cb, elt); 1293 elt->animator = ecore_animator_add(_elua_transition_cb, elt);
1294 if (val < 0.0000001) val = 0.0000001; 1294 if (val < 0.0000001) val = 0.0000001;
@@ -2227,9 +2227,48 @@ _elua_obj_map_source(lua_State *L) // Stack usage [-?, +?, ?]
2227//------------- 2227//-------------
2228/** 2228/**
2229@page luaref 2229@page luaref
2230@subsection ecore_animator Ecore animator class.
2231
2232The lua ecore animator class includes functions for dealing with ecore animator objects.
2233The ecore animator objects must have been previously created by lua using the lua
2234edje object creation function edje:animator() or edje:transition().
2235
2236In the following, "animator_object" is a place holder for any lua variable that
2237holds a reference to an ecore animator object.
2238*/
2239static const char *_elua_ecore_animator_api = "ecore_animator";
2240static const struct luaL_reg _elua_ecore_animator_funcs [] =
2241{
2242 {NULL, NULL} // end
2243};
2244
2245//-------------
2246//-------------
2247/**
2248@page luaref
2249@subsection ecore_timer Ecore timer class.
2250
2251The lua ecore timer class includes functions for dealing with ecore timer objects.
2252The ecore timer objects must have been previously created by lua using the lua
2253edje object creation function edje:timer().
2254
2255In the following, "timer_object" is a place holder for any lua variable that
2256holds a reference to an ecore timer object.
2257*/
2258
2259static const char *_elua_ecore_timer_api = "ecore_timer";
2260static const struct luaL_reg _elua_ecore_timer_funcs [] =
2261{
2262 {NULL, NULL} // end
2263};
2264
2265//-------------
2266//-------------
2267/**
2268@page luaref
2230@subsection evas_edje Evas edje class. 2269@subsection evas_edje Evas edje class.
2231 2270
2232The lua evas odje class includes functions for dealing with evas edje objects. 2271The lua evas edje class includes functions for dealing with evas edje objects.
2233The evas edje objects must have been previously created by lua using the lua 2272The evas edje objects must have been previously created by lua using the lua
2234edje object creation function edje:edje(). 2273edje object creation function edje:edje().
2235 2274
@@ -3237,6 +3276,8 @@ _edje_lua2_script_init(Edje *ed) // Stack usage [-?, +?, ?]
3237 lua_pop(L, 2); 3276 lua_pop(L, 2);
3238 3277
3239 _elua_add_functions(L, _elua_evas_api, _elua_evas_funcs, _elua_evas_meta, NULL, NULL); 3278 _elua_add_functions(L, _elua_evas_api, _elua_evas_funcs, _elua_evas_meta, NULL, NULL);
3279 _elua_add_functions(L, _elua_ecore_timer_api, _elua_ecore_timer_funcs, _elua_ecore_timer_meta, NULL, NULL);
3280 _elua_add_functions(L, _elua_ecore_animator_api, _elua_ecore_animator_funcs, _elua_ecore_animator_meta, NULL, NULL);
3240 _elua_add_functions(L, _elua_evas_edje_api, _elua_evas_edje_funcs, _elua_evas_edje_meta, _elua_evas_edje_parent, _elua_evas_api); 3281 _elua_add_functions(L, _elua_evas_edje_api, _elua_evas_edje_funcs, _elua_evas_edje_meta, _elua_evas_edje_parent, _elua_evas_api);
3241 _elua_add_functions(L, _elua_evas_image_api, _elua_evas_image_funcs, _elua_evas_image_meta, _elua_evas_image_parent, _elua_evas_api); 3282 _elua_add_functions(L, _elua_evas_image_api, _elua_evas_image_funcs, _elua_evas_image_meta, _elua_evas_image_parent, _elua_evas_api);
3242 _elua_add_functions(L, _elua_evas_line_api, _elua_evas_line_funcs, _elua_evas_line_meta, _elua_evas_line_parent, _elua_evas_api); 3283 _elua_add_functions(L, _elua_evas_line_api, _elua_evas_line_funcs, _elua_evas_line_meta, _elua_evas_line_parent, _elua_evas_api);