Lua is intended for script-only objects at this point (with embryo left for augmenting standard programs). Since script-only objects effectively 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 that uses most of this lua API: lua_script.edc
Most of these lua functions are wrappers around various evas, ecore, and edje C functions. Refer to their documentation for more in depth details and up to date documentation. A lot of this documentation is simple copied from the C functions it wraps.
Some of the lua functions can accept a table as well as separate arguments. Some of them return tables.
The lua edje class includes functions for dealing with the lua script only group as an edje object, basic functions, and functions to create other objects.
In the following, "edje" is the actual global table used to access these edje functions.
Make lua a bit shelly. Prints a string to the console
text | The string to print. |
Retrieves the current time and date.
Wraps gettimeofday(), as passed through localtime().
Retrieves the time at which the last loop stopped waiting for timeouts or events.
This gets the time that the main loop ceased waiting for timouts and/or events to come in or for signals or any other interrupt source. This should be considered a reference point for all time based activity that should calculate its timepoint from the return of edje.looptime(). Use this UNLESS you absolutely must get the current actual timepoint - then use edje.seconds(). Note that this time is meant to be used as relative to other times obtained on this run.
Wraps ecore_loop_time_get().
Retrieves the current system time as a floating point value in seconds.
This uses a monotonic clock and thus never goes back in time while machine is live (even if user changes time or timezone changes, however it may be reset whenever the machine is restarted).
Wraps ecore_time_get().
Retrieves the current edje version number.
Retrieves the position and size of the edje object that this lua group is in.
Retrieves the position of the edje object that this lua group is in.
Retrieves the size of the edje object that this lua group is in.
Emit a signal.
Wraps edje_object_signal_emit().
signal | The signal string to send. |
source | The source string of the signal. |
NOTE: The source string will have a name and a colon prepended to in when it is delivered to things that are not this edje, like C and other edje groups. If this edje is a top level edje, then it will be the name of the group (I think). If this edje is swallowed into some other part, then it will be the name of the part:
group_name:source
FIXME: I actually have no idea what happens if it's swallowed into another lua edje group.
Send a message to this edje, and all it's child objects.
Wraps edje_object_message_send().
id | An identification integer for the message. |
type | The type of message to send. |
... | Zero or more things to send as part of the message, depending on the type. |
The type can be one of:
For the array types, the lua caller passes a table.
This function adds an animator and returns its handle on success and NULL on failure. The function func will be called every frame tick. Note that setting the frame tick is not available as a lua function, so has to be done from C. The default tick is 1/30 second.
When the animator func is called, it must return a value of either true or false. If it returns true it will be called again at the next tick, or if it returns false it will be deleted automatically making any references/handles for it invalid.
Wraps ecore_animator_add().
func | The function to call when the animator triggers. |
This function adds a timer and returns its handle on success and NULL on failure. The function func will be called every tick seconds.
When the timer func is called, it must return a value of either true or false. If it returns true, it will be called again at the next tick, or if it returns false it will be deleted automatically making any references/handles for it invalid.
Wraps ecore_timer_add().
tick | How often, in seconds, to call the function. |
func | The function to call when the timer triggers. |
Just like edje.animator(), except that the callback function gets called with an argument. The argument is the amount of time since the transition was created, divided by the div parameter.
div | A number to divide the time since creation by. |
func | The function to call when the transition triggers. |
Gets, (and optionally sets) the colours for a color class.
Wraps edje_object_color_class_set().
class | A color class name. |
r | The new red value. |
g | The new green value. |
b | The new blue value. |
a | The new alpha value. |
Note that the r, g, b, and a arguments are optional, without them this function just queries the current values. The r, g, b, and a arguments can be separate values, or named fields in a table.
Gets, (and optionally sets) the details for a text class.
Wraps edje_object_text_class_set().
class | A text class name. |
font | The new font name. |
size | The new font size. |
Note that the font and size arguments are optional, without them this function just queries the current values. The font and size arguments can be separate values, or named fields in a table. The font name can refer to a font in the edje file, or an external font.
Create an edje object, and add it to the edje.
Wraps edje_object_add().
Create an evas image, and add it to the edje.
Wraps evas_object_image_add().
Create an evas line, and add it to the edje.
Wraps evas_object_line_add().
Create an evas map.
Wraps evas_map_new().
Create an evas polygon, and add it to the edje.
Wraps evas_object_polygon_add().
Create an evas rectangle, and add it to the edje.
Wraps evas_object_rectangle_add().
Create an evas text object, and add it to the edje.
Wraps evas_object_text_add().
The lua evas class includes functions for dealing with evas objects. The evas objects must have been previously created by lua using one of the lua evas object creation functions from the lua edje class.
In the following, "evas_object" is a place holder for any lua variable that holds a reference to an evas object.
Hides the object.
Wraps evas_object_hide().
Shows the object.
Wraps evas_object_show().
Gets (and optionally sets) this objects visibility.
Wraps evas_object_hide() or evas_object_show().
visibility | The new visibility you want to change it to. |
Note that the argument is optional, without it this function just queries the current value.
Figure out what, if anything, is above us.
Wraps evas_object_above_get().
Note that it may not return any value.
Figure out what, if anything, is below us.
Wraps evas_object_below_get().
Note that it may not return any value.
Figure out what, if anything, is waaaay below us.
Note that it may not return any value.
Lower this object to the bottom.
Wraps evas_object_lower().
Raise this object to the top.
Wraps evas_object_raise().
Figure out what, if anything, is waaaay above us.
Note that it may not return any value.
Gets (and optionally sets) this objects geometry.
Wraps evas_object_move() and evas_object_resize.
x | The new X coordinate. |
y | The new Y coordinate. |
w | The new width. |
h | The new height. |
Note that the arguments are optional, without them this function just queries the current values. The arguments can be separate values, or named fields in a table.
Gets (and optionally sets) this objects position.
Wraps evas_object_move().
x | The new X coordinate. |
y | The new Y coordinate. |
Note that the arguments are optional, without them this function just queries the current values. The arguments can be separate values, or named fields in a table.
An alias for evas_object:move().
Gets (and optionally sets) this objects size.
Wraps evas_object_resize().
w | The new width. |
h | The new height. |
Note that the arguments are optional, without them this function just queries the current values. The arguments can be separate values, or named fields in a table.
An alias for evas_object:resize().
Get (and optionally set) the object that clips this object.
Note that the argument is optional, without it this function just queries the current value.
Wraps evas_object_clip_set().
evas_object2 | A reference to the object to clip this object with. |
Gets the list of objects this objects clips.
Wraps evas_object_clipees_get().
Remove any clipping on this object.
Wraps evas_object_clip_unset().
Get the type of this object. See the documentation of the evas_object_type_get() C function for details.
Wraps evas_object_type_get().
Get (and optionally set) whether this object ignores events, passing them to the next object underneath it.
Wraps evas_object_pass_events_set().
pass | A boolean saying if this object passes events. |
Note that the argument is optional, without it this function just queries the current value.
Get (and optionally set) whether to use precise (usually expensive) point collision detection for this object.
Wraps evas_object_precise_is_inside_set().
precise | A boolean saying if this object is precisely detected. |
Note that the argument is optional, without it this function just queries the current value.
Get (and optionally set) whether this object repeats events.
Wraps evas_object_repeat_events_set().
repeat | A boolean saying if this object repeats events to lower objects. |
Note that the argument is optional, without it this function just queries the current value.
Gets (and optionally sets) this objects colour.
Wraps evas_object_color_set().
r | The new red value. |
g | The new green value. |
b | The new blue value. |
a | The new alpha value. |
Note that the arguments are optional, without them this function just queries the current values. The arguments can be separate values, or named fields in a table.
Attach a map to this object.
Wraps evas_object_map_set().
map | The map to attach. |
Enable or disable the map attached to this object.
Wraps evas_object_map_enable_set().
enable | A booleon that controls if the attached map is enabled or not. |
The lua ecore animator class includes functions for dealing with ecore animator objects. The ecore animator objects must have been previously created by lua using the lua edje object creation function edje.animator() or edje.transition().
In the following, "animator_object" is a place holder for any lua variable that holds a reference to an ecore animator object.
The lua ecore timer class includes functions for dealing with ecore timer objects. The ecore timer objects must have been previously created by lua using the lua edje object creation function edje.timer().
In the following, "timer_object" is a place holder for any lua variable that holds a reference to an ecore timer object.
The lua evas edje class includes functions for dealing with evas edje objects. The evas edje objects must have been previously created by lua using the lua edje object creation function edje.edje().
In the following, "edje_object" is a place holder for any lua variable that holds a reference to an evas edje object. NOT the edje class specified earlier though.
Load an edje group into this edje object.
Wraps edje_object_file_set().
file | An edje file name (ignored, sandboxed to the file this lua script is in). |
group | The group within the edje file to be loaded. |
Note that the arguments are optional, without them this function just queries the current values. The arguments can be separate values, or named fields in a table. The file argument is optional, and ignored anyway.
The lua evas image class includes functions for dealing with evas image objects. The evas image objects must have been previously created by lua using the lua image object creation function edje.image().
In the following, "image_object" is a place holder for any lua variable that holds a reference to an evas image object.
Gets (and optionally sets) how to fill this image's drawing rectangle given the (real) image bound to it.
Wraps evas_object_image_fill_set().
x | The x coordinate (from the top left corner of the bound image) to start drawing from. |
y | The y coordinate (from the top left corner of the bound image) to start drawing from. |
w | The width the bound image will be displayed at. |
h | The height the bound image will be displayed at. |
Note that the arguments are optional, without them this function just queries the current values. The arguments can be separate values, or named fields in a table.
Get (and optionally set) whether this image fills the object.
Wraps evas_object_image_filled_set().
filled | A boolean saying if this image fills the object. |
Note that the argument is optional, without it this function just queries the current value.
Load an image into this edje object.
Wraps evas_object_image_file_set().
file | An edje file name (ignored, sandboxed to the file this lua script is in). |
group | The name of an image. |
Note that the arguments are optional, without them this function just queries the current values. The arguments can be separate values, or named fields in a table. The file argument is optional, and ignored anyway.
The lua evas line class includes functions for dealing with evas line objects. The evas line objects must have been previously created by lua using the lua line object creation function edje.line().
In the following, "line_object" is a place holder for any lua variable that holds a reference to an evas line object.
Sets the end points of this line.
Wraps evas_object_line_xy_set().
x1 | The X coordinate of the first line end. |
y1 | The Y coordinate of the first line end. |
x2 | The X coordinate of the other line end. |
y2 | The Y coordinate of the other line end. |
Note that the arguments are optional, without them this function just queries the current values. The arguments can be separate values, or named fields in a table.
The lua evas map class includes functions for dealing with evas map objects. The evas map objects must have been previously created by lua using the lua map object creation function edje.map(). The evas map system is complex, rather than repeat the copious documentation here, please refer to the evas map documentation. It has pictures and everything. B-)
In the following, "map_object" is a place holder for any lua variable that holds a reference to an evas map object.
Get (and optionally set) the maps alpha mode.
Wraps evas_map_alpha_set().
alpha | The alpha mode. |
Note that the argument is optional, without it this function just queries the current value.
Get the maps clockwise state.
Wraps evas_map_util_clockwise_get().
Gets or sets colour information for the map. There are two variations, with or without the index. With the index parameter it gets (and optionally sets) the colour of the point the index refers to, without it sets the colour for the entire map.
Wraps evas_map_point_color_set() or evas_map_util_points_color_set()
index | Which point to change the colour of. |
r | The new red value. |
g | The new green value. |
b | The new blue value. |
a | The new alpha value. |
Note that the arguments are optional, without them this function just queries the current values. The colour arguments can be separate values, or named fields in a table.
Gets (and optionally sets) the 3D coordinates of a point on the map.
Wraps evas_map_point_coord_set().
x | The x coordinate of the point. |
y | The y coordinate of the point. |
z | The z coordinate of the point. |
Note that the arguments are optional, without them this function just queries the current values. The coordinate arguments can be separate values, or named fields in a table.
Set the 3D lights for the map. The three triplets can be tables.
Wraps evas_map_util_3d_lighting().
x | The x coordinate of the light point. |
y | The y coordinate of the light point. |
z | The z coordinate of the light point. |
r | The new red value of the light point. |
g | The new green value of the light point. |
b | The new blue value of the light point. |
ar | The new red value of the ambient light. |
ag | The new green value of the ambient light. |
ab | The new blue value of the ambient light. |
Apply a perspective transform to the map.
Wraps evas_map_util_3d_perspective().
The arguments can be separate values, or named fields in a table.
x | The perspective distance X coordinate |
y | The perspective distance Y coordinate |
z | The "0" z plane value |
f | The focal distance |
Populate the points in a map, in one of three different methods.
1) Wraps evas_map_util_points_populate_from_object().
source | An evas object to copy points from. |
2) Wraps evas_map_util_paints_populate_from_object_full().
source | An evas object to copy points from. |
z | Common Z coordinate hint for all four points. |
3) Wraps evas_map_util_points_populate_from_geometry().
The first four arguments can be separate values, or named fields in a table.
x | Point X coordinate |
y | Point Y coordinate |
w | Width to use to calculate second and third points. |
h | Height to use to calculate third and fourth points. |
z | Common Z coordinate hint for all four points. |
Rotate the maps coordinates in 2D.
Wraps evas_map_util_rotate().
The coordinates can be separate values, or named fields in a table.
degrees | Amount of degrees from 0.0 to 360.0 to rotate. |
x | Rotation's centre horizontal position. |
y | Rotation's centre vertical position. |
Rotate the maps coordinates in 3D.
Wraps evas_map_util_3d_rotate().
The coordinates can be separate values, or named fields in a table. The same with the rotation.
dx | Amount of degrees from 0.0 to 360.0 to rotate around X axis. |
dy | Amount of degrees from 0.0 to 360.0 to rotate around Y axis. |
dz | Amount of degrees from 0.0 to 360.0 to rotate around Z axis. |
x | Rotation's centre horizontal position. |
y | Rotation's centre vertical position. |
z | Rotation's centre vertical position. |
Get (and optionally set) the maps smooth mode.
Wraps evas_map_smooth_set().
smooth | The smooth mode. |
Note that the argument is optional, without it this function just queries the current value.
Gets (and optionally sets) the texture U and V texture coordinates for this map.
Wraps evas_map_point_image_uv_set().
index | Index of the point to change. Must be smaller than map size. |
u | The X coordinate within the image/texture source. |
v | The Y coordinate within the image/texture source. |
Note that the U,V arguments are optional, without them this function just queries the current values. The coordinate arguments can be separate values, or named fields in a table.
Apply a zoom to the map.
Wraps evas_map_util_zoom().
The arguments can be two separate values, or named fields in a table.
x | The horizontal zoom amount. |
y | The vertical zoom amount. |
x | The X coordinate of the centre of the zoom. |
y | The Y coordinate of the centre of the zoom. |
The lua evas polygon class includes functions for dealing with evas polygon objects. The evas polygon objects must have been previously created by lua using the lua polygon object creation function edje.polygon().
In the following, "polygon_object" is a place holder for any lua variable that holds a reference to an evas polygon object.
Clears all points from the polygon.
Wraps evas_object_polygon_points_clear(),
Adds a point to this polygon.
Wraps evas_object_polygon_point_add().
x | The X coordinate of the point. |
y | The Y coordinate of the point. |
The lua evas text class includes functions for dealing with evas text objects. The evas text objects must have been previously created by lua using the lua text object creation function edje.text().
In the following, "text_object" is a place holder for any lua variable that holds a reference to an evas text object.
Gets, (and optionally sets) the font for this text object.
Wraps evas_object_text_font_set().
font | The new font name. |
size | The new font size. |
Note that the font and size arguments are optional, without them this function just queries the current values. The font and size arguments can be separate values, or named fields in a table. The font name can refer to a font in the edje file, or an external font.
Get (and optionally set) the actual text for this text object.
Wraps evas_object_text_text_set().
text | The text to set for this text object. |
Note that the argument is optional, without it this function just queries the current value.
These are lua functions that are called by the lua edje system when certain events occur. If the functions don't exist in the lua group, they don't get called.
If a function called "shutdown" exists in a lua edje group, then it is called when that edje gets deleted.
If a function called "show" exists in a lua edje group, then it is called when that edje gets shown.
If a function called "hide" exists in a lua edje group, then it is called when that edje gets hidden.
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.
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.
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.
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.