From 5c2f79ac327c6ae4fc3304fb52dc33602639ea2c Mon Sep 17 00:00:00 2001 From: onefang Date: Thu, 17 Nov 2011 18:13:58 +0000 Subject: [PATCH] Document the lua callback hooks. git-svn-id: http://svn.enlightenment.org/svn/e/trunk/edje@65347 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/examples/lua_script.edc | 10 +++++----- src/lib/edje_lua2.c | 35 +++++++++++++++++++++++++++-------- 2 files changed, 32 insertions(+), 13 deletions(-) diff --git a/src/examples/lua_script.edc b/src/examples/lua_script.edc index fd8f2d6..001681e 100644 --- a/src/examples/lua_script.edc +++ b/src/examples/lua_script.edc @@ -249,12 +249,12 @@ collections { D.edje:resize(w, h); end - function message (id, type, v1, v2) + function message (id, type, ...) print("lua::message id=" .. id .. " type=" .. type); - --// handle your message type here. check id + type then use v1 - --// and/or v2 (or neither) appropriately. they are the same as - --// the 2nd and 3rd param passed to edje.messagesend() (if any - --// are passed at all) + --// handle your message type here. check id + type then use the + --// vararg appropriately. they are the same as the params passed + --// to edje:messagesend() (if any are passed at all). Any array + --// arguments are passed as a single table. end function signal (sig, src) diff --git a/src/lib/edje_lua2.c b/src/lib/edje_lua2.c index bb6224e..d9c960e 100644 --- a/src/lib/edje_lua2.c +++ b/src/lib/edje_lua2.c @@ -28,7 +28,7 @@ define objects entirely via Lua script (resize handling, event handling etc. etc.) this places many more demands on them, and thus a more powerful language is in order. Lua is that language. -To get you started, here's an example: +To get you started, here's an example that uses most of this lua API: @ref lua_script.edc Most of these lua functions are wrappers around various evas, ecore, and edje C @@ -896,6 +896,8 @@ The type can be one of: - strfloat: The message is a C string and a C float. - strintset: The message is a C string and an array of C integers. - strfloatset: The message is a G string and an array of C floats. + +For the array types, the lua caller passes a table. */ static int _elua_messagesend(lua_State *L) // Stack usage [-?, +?, ?] @@ -3369,8 +3371,10 @@ called. /** @page luaref -@subsection edje_shutdown Edje shutdown callback. +@subsection edje_shutdown Edje shutdown() callback. +If a function called "shutdown" exists in a lua edje group, then it is called when +that edje gets deleted. */ void _edje_lua2_script_func_shutdown(Edje *ed) // Stack usage [-?, +?, ?] @@ -3390,8 +3394,10 @@ _edje_lua2_script_func_shutdown(Edje *ed) // Stack usage [-?, +?, ?] /** @page luaref -@subsection edje_show Edje show callback. +@subsection edje_show Edje show() callback. +If a function called "show" exists in a lua edje group, then it is called when +that edje gets shown. */ void _edje_lua2_script_func_show(Edje *ed) // Stack usage [-?, +?, ?] @@ -3410,8 +3416,10 @@ _edje_lua2_script_func_show(Edje *ed) // Stack usage [-?, +?, ?] /** @page luaref -@subsection edje_hide Edje hide callback. +@subsection edje_hide Edje hide() callback. +If a function called "hide" exists in a lua edje group, then it is called when +that edje gets hidden. */ void _edje_lua2_script_func_hide(Edje *ed) // Stack usage [-?, +?, ?] @@ -3430,8 +3438,10 @@ _edje_lua2_script_func_hide(Edje *ed) // Stack usage [-?, +?, ?] /** @page luaref -@subsection edje_move Edje move callback. +@subsection edje_move Edje move(x, y) callback. +If a function called "move" exists in a lua edje group, then it is called when +that edje gets moved, with the new position passed to it. */ void _edje_lua2_script_func_move(Edje *ed) // Stack usage [-?, +?, ?] @@ -3453,8 +3463,10 @@ _edje_lua2_script_func_move(Edje *ed) // Stack usage [-?, +?, ?] /** @page luaref -@subsection edje_resize Edje resize callback. +@subsection edje_resize Edje resize(w, h) callback. +If a function called "resize" exists in a lua edje group, then it is called when +that edje gets resized, with the new size passed to it. */ void _edje_lua2_script_func_resize(Edje *ed) // Stack usage [-?, +?, ?] @@ -3475,8 +3487,12 @@ _edje_lua2_script_func_resize(Edje *ed) // Stack usage [-?, +?, ?] /** @page luaref -@subsection edje_message Edje message callback. +@subsection edje_message Edje message(id, type, ...) callback. +If a function called "message" exists in a lua edje group, then it is called when +that edje gets gets a message sent to it, with the message details passed to it. +See edje:messagesend() for details of what each type means. The arrays are +passed as a table. */ void _edje_lua2_script_func_message(Edje *ed, Edje_Message *em) // Stack usage [-?, +?, ?] @@ -3591,7 +3607,10 @@ _edje_lua2_script_func_message(Edje *ed, Edje_Message *em) // Stack usage [-?, /** @page luaref -@subsection edje_signal Edje signal callback. +@subsection edje_signal Edje signal(signal, source) callback. + +If a function called "signal" exists in a lua edje group, then it is called when +ever a signal arrives, with the signal details passed to it. */ void -- 2.7.4