\hypertarget{lua_script_8edc-example}{\section{lua\-\_\-script.\-edc}
}
This example shows the usage of lua scripting to create and animate some objects in the canvas.


\begin{DoxyCodeInclude}
color\_classes \{
    color\_class \{ name: \textcolor{stringliteral}{"test\_colour"}; color: 255 255 255 255; \}
\}

fonts \{
   font: \textcolor{stringliteral}{"Vera.ttf"} \textcolor{stringliteral}{"default"};
\}

images \{
    image: \textcolor{stringliteral}{"bubble.png"} COMP;
    image: \textcolor{stringliteral}{"test.png"} COMP;
\}

collections \{
   group \{
      name: \textcolor{stringliteral}{"main"};
      lua\_script\_only: 1;
      lua\_script \{
         --\textcolor{comment}{// stick object private/local vars here}
         local D;
         local count = 0;
         local fndata = 99;
         local text\_geom;

         --\textcolor{comment}{// Functions to print tables.}
         local print\_table, print\_table\_start;

         \textcolor{keyword}{function} print\_table\_start(table, space, name)
            print(space .. name .. ": ");
            print(space .. "\{\textcolor{stringliteral}{");}
\textcolor{stringliteral}{            print\_table(table, space .. "}  \textcolor{stringliteral}{");}
\textcolor{stringliteral}{            print(space .. "}\}\textcolor{stringliteral}{");}
\textcolor{stringliteral}{         end}
\textcolor{stringliteral}{}
\textcolor{stringliteral}{         function print\_table(table, space)}
\textcolor{stringliteral}{            for k, v in pairs(table) do }
\textcolor{stringliteral}{               if type(v) == "}table\textcolor{stringliteral}{" then}
\textcolor{stringliteral}{                  print\_table\_start(v, space, k);}
\textcolor{stringliteral}{               elseif type(v) == "}\textcolor{keywordtype}{string}\textcolor{stringliteral}{" then}
\textcolor{stringliteral}{                  print(space .. k .. ': "}\textcolor{stringliteral}{' .. v .. '}\textcolor{stringliteral}{";')}
\textcolor{stringliteral}{               else}
\textcolor{stringliteral}{                  print(space .. k .. "}: \textcolor{stringliteral}{" .. v .. "};\textcolor{stringliteral}{")}
\textcolor{stringliteral}{               end}
\textcolor{stringliteral}{            end}
\textcolor{stringliteral}{         end}
\textcolor{stringliteral}{}
\textcolor{stringliteral}{         local function mycb3 (v)}
\textcolor{stringliteral}{            print("}lua::callback transition \textcolor{stringliteral}{" .. D.val .. "} v: \textcolor{stringliteral}{" .. v);}
\textcolor{stringliteral}{            d = \{\};}
\textcolor{stringliteral}{            d = edje.size(d);}
\textcolor{stringliteral}{            print("}lua::objsize= \textcolor{stringliteral}{" .. d.w .. "} , \textcolor{stringliteral}{" .. d.h);}
\textcolor{stringliteral}{            sz = \{w=v * 80, h=v * 40\};}
\textcolor{stringliteral}{            D.rect:geom(((d.w / 2) * math.sin(v * 2 * math.pi)) + ((d.w - sz.w) / 2),}
\textcolor{stringliteral}{                        ((d.h / 2) * math.cos(v * 2 * math.pi)) + ((d.h - sz.h) / 2),}
\textcolor{stringliteral}{                        sz.w, sz.h);}
\textcolor{stringliteral}{            D.rect:color(255, 128, v * 255, 255);}
\textcolor{stringliteral}{            d = D.rect:move(d);}
\textcolor{stringliteral}{            print("}lua::pos= \textcolor{stringliteral}{" .. d.x .. "} , \textcolor{stringliteral}{" .. d.y);}
\textcolor{stringliteral}{ }
\textcolor{stringliteral}{            r = D.rect:above();}
\textcolor{stringliteral}{            if (r ~= nil) then}
\textcolor{stringliteral}{               print("}lua::rcol\textcolor{stringliteral}{");}
\textcolor{stringliteral}{               r:color(20, v * 255, 60, 255);}
\textcolor{stringliteral}{            else}
\textcolor{stringliteral}{               print("}lua::r none!!!!!!!!!!!!!!1\textcolor{stringliteral}{");}
\textcolor{stringliteral}{            end}
\textcolor{stringliteral}{            d = edje.size();}
\textcolor{stringliteral}{            D.clip:geom(10, 10, d.w - 20, d.h - 20);}
\textcolor{stringliteral}{            c = D.clip:clipees();}
\textcolor{stringliteral}{            for i=1,#c,1 do}
\textcolor{stringliteral}{               d = c[i]:geom();}
\textcolor{stringliteral}{               print("}lua::\textcolor{stringliteral}{" .. i .. "} geom = \textcolor{stringliteral}{" .. d.x .. "},\textcolor{stringliteral}{" .. d.y .. "} \textcolor{stringliteral}{" .. d.w .. "}x\textcolor{stringliteral}{" .. d.h);}
\textcolor{stringliteral}{            end}
\textcolor{stringliteral}{            return true;  --// repeat the timer}
\textcolor{stringliteral}{         end}
\textcolor{stringliteral}{ }
\textcolor{stringliteral}{         local function mycb2 ()}
\textcolor{stringliteral}{            print("}lua::callback animator \textcolor{stringliteral}{" .. count .. "} seconds: \textcolor{stringliteral}{" .. edje.seconds() .. "} looptime: \textcolor{stringliteral}{" ..
       edje.looptime());}
\textcolor{stringliteral}{            edje.color\_class("}test\_colour\textcolor{stringliteral}{", 255, (count * 10) % 255, 255, 255);}
\textcolor{stringliteral}{            edje.text\_class("}test\_text\_class\textcolor{stringliteral}{", "}Sans:style=Bold\textcolor{stringliteral}{", ((count * 3) % 100) + 8);}
\textcolor{stringliteral}{            if (5 > (count % 10)) then}
\textcolor{stringliteral}{               D.text:font("}\textcolor{keywordflow}{default}\textcolor{stringliteral}{", 32);}
\textcolor{stringliteral}{            else}
\textcolor{stringliteral}{               D.text:font("}Sans:style=Bold\textcolor{stringliteral}{", 32);}
\textcolor{stringliteral}{            end}
\textcolor{stringliteral}{            edje\_geom = edje.geom();}
\textcolor{stringliteral}{            text\_geom = D.text:geom();}
\textcolor{stringliteral}{            D.text:move((edje\_geom.w - text\_geom.w) / 2, (edje\_geom.h - text\_geom.h) / 8);}
\textcolor{stringliteral}{            return true;  --// repeat the timer}
\textcolor{stringliteral}{         end}
\textcolor{stringliteral}{ }
\textcolor{stringliteral}{         local function mycb ()}
\textcolor{stringliteral}{            print("}lua::callback timer \textcolor{stringliteral}{" .. count .. "} fndata = \textcolor{stringliteral}{" .. fndata);}
\textcolor{stringliteral}{            count = count + 1; --// keep count of calls - object data}
\textcolor{stringliteral}{            fndata = fndata + 3; --// play with object vars to see if they persist}
\textcolor{stringliteral}{            D.tim = edje.timer(0.25, mycb); --// inside cb add new timer}
\textcolor{stringliteral}{            return false; --// cease repeating the timer}
\textcolor{stringliteral}{         end}
\textcolor{stringliteral}{ }
\textcolor{stringliteral}{         --// init object here}
\textcolor{stringliteral}{         D = \{\}; --// data is empty table to start}
\textcolor{stringliteral}{         D.val = math.random(); --// start with some random value so}
\textcolor{stringliteral}{         fndata = fndata + D.val; --// func data start point}
\textcolor{stringliteral}{         print("}lua::init ... \textcolor{stringliteral}{" .. D.val);}
\textcolor{stringliteral}{         edje.echo("}lua::echo(\textcolor{stringliteral}{'hello world'})\textcolor{stringliteral}{");}
\textcolor{stringliteral}{}
\textcolor{stringliteral}{         --// How to check the edje version.}
\textcolor{stringliteral}{         version = edje.version();}
\textcolor{stringliteral}{         print("}The edje version number is \textcolor{stringliteral}{" .. version.major .. "}.\textcolor{stringliteral}{" .. version.minor);}
\textcolor{stringliteral}{}
\textcolor{stringliteral}{         --// actually add the timer to call mycb in 1.23 sec}
\textcolor{stringliteral}{         D.tim = edje.timer(1.23, mycb);}
\textcolor{stringliteral}{         D.tra = edje.transition(5.0, mycb3);}
\textcolor{stringliteral}{         D.ani = edje.animator(mycb2);}
\textcolor{stringliteral}{         edje\_geom = edje.geom();}
\textcolor{stringliteral}{ }
\textcolor{stringliteral}{         if (edje.spanky) then edje.spanky(); end}
\textcolor{stringliteral}{}
\textcolor{stringliteral}{         local date = edje.date();}
\textcolor{stringliteral}{         print("}lua:: date: \textcolor{stringliteral}{" ..}
\textcolor{stringliteral}{            date.year .. "}|\textcolor{stringliteral}{" ..}
\textcolor{stringliteral}{            date.month .. "}|\textcolor{stringliteral}{" ..}
\textcolor{stringliteral}{            date.day .. "}|\textcolor{stringliteral}{" ..}
\textcolor{stringliteral}{            date.yearday .. "}|\textcolor{stringliteral}{" ..}
\textcolor{stringliteral}{            date.weekday .. "}|\textcolor{stringliteral}{" ..}
\textcolor{stringliteral}{            date.hour .. "}|\textcolor{stringliteral}{" ..}
\textcolor{stringliteral}{            date.min .. "}|\textcolor{stringliteral}{" ..}
\textcolor{stringliteral}{            date.sec}
\textcolor{stringliteral}{         );}
\textcolor{stringliteral}{}
\textcolor{stringliteral}{         --// send some random edje message}
\textcolor{stringliteral}{         edje.messagesend(7, "}none\textcolor{stringliteral}{"      );}
\textcolor{stringliteral}{         edje.messagesend(7, "}sig\textcolor{stringliteral}{",      "}signal\textcolor{stringliteral}{", "}source\textcolor{stringliteral}{");}
\textcolor{stringliteral}{         edje.messagesend(7, "}str\textcolor{stringliteral}{",      "}hello world\textcolor{stringliteral}{");}
\textcolor{stringliteral}{         edje.messagesend(7, "}\textcolor{keywordtype}{int}\textcolor{stringliteral}{",      987);}
\textcolor{stringliteral}{         edje.messagesend(7, "}\textcolor{keywordtype}{float}\textcolor{stringliteral}{",    987.321);}
\textcolor{stringliteral}{         edje.messagesend(7, "}strset\textcolor{stringliteral}{",   \{"}hello\textcolor{stringliteral}{", "}there\textcolor{stringliteral}{", "}world\textcolor{stringliteral}{"\});}
\textcolor{stringliteral}{         edje.messagesend(7, "}intset\textcolor{stringliteral}{",   \{1, 2, 3\});}
\textcolor{stringliteral}{         edje.messagesend(7, "}floatset\textcolor{stringliteral}{", \{1.1, 2.2, 3.3\});}
\textcolor{stringliteral}{         edje.messagesend(7, "}strint\textcolor{stringliteral}{",   "}hello world\textcolor{stringliteral}{", 7);}
\textcolor{stringliteral}{         edje.messagesend(7, "}strfloat\textcolor{stringliteral}{", "}hello world\textcolor{stringliteral}{", 7.654);}
\textcolor{stringliteral}{         edje.messagesend(7, "}strintset\textcolor{stringliteral}{","}hello world\textcolor{stringliteral}{", \{1, 2, 3\});}
\textcolor{stringliteral}{}
\textcolor{stringliteral}{         D.edje = edje.edje();}
\textcolor{stringliteral}{         D.edje:file("}plain/edje/group\textcolor{stringliteral}{");}
\textcolor{stringliteral}{         D.edje:show();}
\textcolor{stringliteral}{                  }
\textcolor{stringliteral}{         D.rect = edje.rect();}
\textcolor{stringliteral}{         D.rect:geom  (5, 10, 50, 30);}
\textcolor{stringliteral}{         D.rect:color (255, 128, 60, 255);}
\textcolor{stringliteral}{         D.rect:show  ();}
\textcolor{stringliteral}{                  }
\textcolor{stringliteral}{         D.rect2 = edje.rect();}
\textcolor{stringliteral}{         D.rect2:geom  (50, 50, 50, 50);}
\textcolor{stringliteral}{         D.rect2:color (20, 30, 60, 120);}
\textcolor{stringliteral}{         D.rect2:show  ();}
\textcolor{stringliteral}{}
\textcolor{stringliteral}{         D.clip = edje.rect();}
\textcolor{stringliteral}{         D.clip:geom  (10, 10, 150, 150);}
\textcolor{stringliteral}{         D.clip:color (200, 200, 50, 200);}
\textcolor{stringliteral}{         D.clip:show  ();}
\textcolor{stringliteral}{ }
\textcolor{stringliteral}{         D.rect2:clip(D.clip);}
\textcolor{stringliteral}{         D.rect:clip(D.clip);}
\textcolor{stringliteral}{}
\textcolor{stringliteral}{         D.text = edje.text();}
\textcolor{stringliteral}{         D.text:geom  (50, 5, 150, 50);}
\textcolor{stringliteral}{         D.text:color (255, 0, 0, 255);}
\textcolor{stringliteral}{         D.text:font("}Sans:style=Bold\textcolor{stringliteral}{", 32);}
\textcolor{stringliteral}{         D.text:text("}Lua rocks!\textcolor{stringliteral}{");}
\textcolor{stringliteral}{         text\_geom = D.text:geom();}
\textcolor{stringliteral}{         print(D.text:text());}
\textcolor{stringliteral}{         D.text:show();}
\textcolor{stringliteral}{}
\textcolor{stringliteral}{        --// Put a few bogus API calls here to test the bogus API protection,}
\textcolor{stringliteral}{        --// If the bogus API protection works, these should get ignored, but everything else runs
       smoothly.}
\textcolor{stringliteral}{        --// Otherwise, the map is not done, the bubbles are not done, but the timers keep runinng.}
\textcolor{stringliteral}{         bogus.failme(1, "}two\textcolor{stringliteral}{", D.rect);}
\textcolor{stringliteral}{         temp = bogus.failme2();}
\textcolor{stringliteral}{         D.text.bogus();}
\textcolor{stringliteral}{         edje.bogus2();}
\textcolor{stringliteral}{}
\textcolor{stringliteral}{         --// Fun with maps!}
\textcolor{stringliteral}{         D.map = edje.map(4);  --// 4 is the only supported map size at the moment.}
\textcolor{stringliteral}{         --// These all do the same thing.}
\textcolor{stringliteral}{         --// Note, lua likes to start at 1, C (and thus evas) at 0.  I choose to agree with C.}
\textcolor{stringliteral}{         D.map:coord(0, 50, 50, 0);}
\textcolor{stringliteral}{         D.map:coord(1, 100, 50, 0);}
\textcolor{stringliteral}{         D.map:coord(2, 100, 100, 0);}
\textcolor{stringliteral}{         D.map:coord(3, 50, 100, 0);}
\textcolor{stringliteral}{         D.map:populate(50, 50, 50, 50, 0);}
\textcolor{stringliteral}{         D.map:populate(D.rect2, 0);}
\textcolor{stringliteral}{         D.map:populate(D.rect2);}
\textcolor{stringliteral}{}
\textcolor{stringliteral}{         --// print the results}
\textcolor{stringliteral}{         D.coord = D.map:coord(0);}
\textcolor{stringliteral}{         print("}lua::map coords \textcolor{keywordflow}{for} point 0 x=\textcolor{stringliteral}{" .. D.coord.x .. "} y=\textcolor{stringliteral}{" .. D.coord.y .. "} z=\textcolor{stringliteral}{" .. D.coord.z);}
\textcolor{stringliteral}{         D.coord = D.map:coord(1);}
\textcolor{stringliteral}{         print("}lua::map coords \textcolor{keywordflow}{for} point 1 x=\textcolor{stringliteral}{" .. D.coord.x .. "} y=\textcolor{stringliteral}{" .. D.coord.y .. "} z=\textcolor{stringliteral}{" .. D.coord.z);}
\textcolor{stringliteral}{         D.coord = D.map:coord(2);}
\textcolor{stringliteral}{         print("}lua::map coords \textcolor{keywordflow}{for} point 2 x=\textcolor{stringliteral}{" .. D.coord.x .. "} y=\textcolor{stringliteral}{" .. D.coord.y .. "} z=\textcolor{stringliteral}{" .. D.coord.z);}
\textcolor{stringliteral}{         D.coord = D.map:coord(3);}
\textcolor{stringliteral}{         print("}lua::map coords \textcolor{keywordflow}{for} point 3 x=\textcolor{stringliteral}{" .. D.coord.x .. "} y=\textcolor{stringliteral}{" .. D.coord.y .. "} z=\textcolor{stringliteral}{" .. D.coord.z);}
\textcolor{stringliteral}{}
\textcolor{stringliteral}{         D.map:smooth(false);}
\textcolor{stringliteral}{         D.map:alpha(true);}
\textcolor{stringliteral}{}
\textcolor{stringliteral}{         if (D.map:alpha()) then}
\textcolor{stringliteral}{            print("}lua::map is alpha\textcolor{stringliteral}{");}
\textcolor{stringliteral}{         end}
\textcolor{stringliteral}{}
\textcolor{stringliteral}{         if (D.map:smooth()) then}
\textcolor{stringliteral}{            print("}lua::map is smooooth\textcolor{stringliteral}{");}
\textcolor{stringliteral}{         end}
\textcolor{stringliteral}{}
\textcolor{stringliteral}{         if (D.map:clockwise()) then}
\textcolor{stringliteral}{            print("}lua::map is clockwise\textcolor{stringliteral}{");}
\textcolor{stringliteral}{         end}
\textcolor{stringliteral}{}
\textcolor{stringliteral}{         D.map:color(255, 255, 255, 255); // set all points to this colour.}
\textcolor{stringliteral}{         D.map:color(1, 255, 0, 255, 255);  // set just one point to this colour.}
\textcolor{stringliteral}{}
\textcolor{stringliteral}{         D.map:lighting(75, 75, 10, 255, 255, 255, 0, 255, 0);  // Ambient light and a 3D light source.}
\textcolor{stringliteral}{}
\textcolor{stringliteral}{         --// Toss it around.}
\textcolor{stringliteral}{         D.map:rotate(45.0, 75, 75);}
\textcolor{stringliteral}{         D.map:zoom(1.5, 1.5, 75, 75);}
\textcolor{stringliteral}{         D.map:rotate3d(10.0, 20.0, 30.0, 75, 75, 0);}
\textcolor{stringliteral}{         D.map:perspective(200, 200, 0, 20);}
\textcolor{stringliteral}{}
\textcolor{stringliteral}{         --// For image UV mapping.}
\textcolor{stringliteral}{         D.map:uv(0, 0.0, 0.0);}
\textcolor{stringliteral}{         D.map:uv(1, 50.0, 0.0);}
\textcolor{stringliteral}{         D.map:uv(2, 50.0, 50.0);}
\textcolor{stringliteral}{         D.map:uv(3, 0.0, 50.0);}
\textcolor{stringliteral}{}
\textcolor{stringliteral}{         --// Actually apply the resulting transformations.}
\textcolor{stringliteral}{         D.rect2:map(D.map);}
\textcolor{stringliteral}{         D.rect2:map\_enable(true);}
\textcolor{stringliteral}{         if (D.rect2:map\_enable()) then}
\textcolor{stringliteral}{            print("}lua::map enabled\textcolor{stringliteral}{");}
\textcolor{stringliteral}{         end}
\textcolor{stringliteral}{}
\textcolor{stringliteral}{         D.rect2:map\_source(D.rect);  --// Don't think this is actually implemented in evas.}
\textcolor{stringliteral}{}
\textcolor{stringliteral}{--//         D.map:dup();}
\textcolor{stringliteral}{--//         D.map:size();  --// perhaps overide the # operator?  For now it's only gonna return 4 anyway.}
\textcolor{stringliteral}{}
\textcolor{stringliteral}{         --// example of deleting something}
\textcolor{stringliteral}{         --// D.tim:del();}
\textcolor{stringliteral}{}
\textcolor{stringliteral}{         --// test the color\_class stuff}
\textcolor{stringliteral}{         colour = edje.color\_class("}test\_colour\textcolor{stringliteral}{");}
\textcolor{stringliteral}{         print("}lua::color\_class= \textcolor{stringliteral}{" .. colour.r .. "},\textcolor{stringliteral}{" .. colour.g .. "},\textcolor{stringliteral}{" .. colour.b .. "},\textcolor{stringliteral}{" .. colour.a);}
\textcolor{stringliteral}{         colour = edje.color\_class("}test\_colour\textcolor{stringliteral}{", 32, 64, 255, 128);}
\textcolor{stringliteral}{         print("}lua::color\_class= \textcolor{stringliteral}{" .. colour.r .. "},\textcolor{stringliteral}{" .. colour.g .. "},\textcolor{stringliteral}{" .. colour.b .. "},\textcolor{stringliteral}{" .. colour.a);}
\textcolor{stringliteral}{         colour = edje.color\_class("}test\_colour\textcolor{stringliteral}{", \{ r=255, g=0, b=255, a=255 \});}
\textcolor{stringliteral}{         print("}lua::color\_class= \textcolor{stringliteral}{" .. colour.r .. "},\textcolor{stringliteral}{" .. colour.g .. "},\textcolor{stringliteral}{" .. colour.b .. "},\textcolor{stringliteral}{" .. colour.a);}
\textcolor{stringliteral}{         text = edje.text\_class("}test\_text\_class\textcolor{stringliteral}{", "}Sans:style=Bold\textcolor{stringliteral}{", 8);}
\textcolor{stringliteral}{         print("}lua::text\_class= \textcolor{stringliteral}{" .. text.font .. "} size \textcolor{stringliteral}{" .. text.size);}
\textcolor{stringliteral}{ }
\textcolor{stringliteral}{         --// Do something bad, just to see what happens.}
\textcolor{stringliteral}{--//         edje.color\_class(nil);}
\textcolor{stringliteral}{ }
\textcolor{stringliteral}{         --// shutdown func - generally empty or not there. everything garbage collected for you}
\textcolor{stringliteral}{         function shutdown ()}
\textcolor{stringliteral}{            print("}lua::shutdown ... \textcolor{stringliteral}{" .. D.val);}
\textcolor{stringliteral}{         end}
\textcolor{stringliteral}{}
\textcolor{stringliteral}{         function show ()}
\textcolor{stringliteral}{            print("}lua::show ... \textcolor{stringliteral}{" .. D.val);}
\textcolor{stringliteral}{         end}
\textcolor{stringliteral}{}
\textcolor{stringliteral}{         function hide ()}
\textcolor{stringliteral}{            print("}lua::hide ... \textcolor{stringliteral}{" .. D.val);}
\textcolor{stringliteral}{         end}
\textcolor{stringliteral}{}
\textcolor{stringliteral}{         function move (x, y)}
\textcolor{stringliteral}{            print("}lua::move x=\textcolor{stringliteral}{" .. x .. "} x=\textcolor{stringliteral}{" .. y);}
\textcolor{stringliteral}{            D.edje:move(0, 0);}
\textcolor{stringliteral}{         end}
\textcolor{stringliteral}{}
\textcolor{stringliteral}{         function resize (w, h)}
\textcolor{stringliteral}{            print("}lua::resize w=\textcolor{stringliteral}{" .. w .. "} h=\textcolor{stringliteral}{" .. h);}
\textcolor{stringliteral}{            D.text:move((w - text\_geom.w) / 2, (h - text\_geom.h) / 8);}
\textcolor{stringliteral}{            D.edje:resize(w, h);}
\textcolor{stringliteral}{         end}
\textcolor{stringliteral}{}
\textcolor{stringliteral}{         function message (id, type, ...)}
\textcolor{stringliteral}{            print("}lua::message \textcolor{keywordtype}{id}=\textcolor{stringliteral}{" .. id .. "} type=\textcolor{stringliteral}{" .. type);}
\textcolor{stringliteral}{            --// handle your message type here. check id + type then use the}
\textcolor{stringliteral}{            --// vararg appropriately. they are the same as the params passed }
\textcolor{stringliteral}{            --// to edje:messagesend() (if any are passed at all).  Any array}
\textcolor{stringliteral}{            --// arguments are passed as a single table.}
\textcolor{stringliteral}{}
\textcolor{stringliteral}{            if ("}none\textcolor{stringliteral}{" == type) then}
\textcolor{stringliteral}{               print("}lua::message no args\textcolor{stringliteral}{");}
\textcolor{stringliteral}{            elseif ("}strset\textcolor{stringliteral}{" == type) then}
\textcolor{stringliteral}{               strs = ... ;}
\textcolor{stringliteral}{               print\_table\_start(strs, "}\textcolor{stringliteral}{", "}lua::message strings\textcolor{stringliteral}{");}
\textcolor{stringliteral}{            elseif ("}intset\textcolor{stringliteral}{" == type) then}
\textcolor{stringliteral}{               ints = ... ;}
\textcolor{stringliteral}{               print\_table\_start(ints, "}\textcolor{stringliteral}{", "}lua::message ints\textcolor{stringliteral}{");}
\textcolor{stringliteral}{            elseif ("}floatset\textcolor{stringliteral}{" == type) then}
\textcolor{stringliteral}{               floats = ... ;}
\textcolor{stringliteral}{               print\_table\_start(floats, "}\textcolor{stringliteral}{", "}lua::message floats\textcolor{stringliteral}{");}
\textcolor{stringliteral}{            elseif ("}strintset\textcolor{stringliteral}{" == type) then}
\textcolor{stringliteral}{               str, ints = ... ;}
\textcolor{stringliteral}{               print("}lua::message \textcolor{stringliteral}{" .. str);}
\textcolor{stringliteral}{               print\_table\_start(ints, "}\textcolor{stringliteral}{", "}lua::message ints\textcolor{stringliteral}{");}
\textcolor{stringliteral}{            elseif ("}strfloatset\textcolor{stringliteral}{" == type) then}
\textcolor{stringliteral}{               str, floats = ... ;}
\textcolor{stringliteral}{               print("}lua::message \textcolor{stringliteral}{" .. str);}
\textcolor{stringliteral}{               print\_table\_start(floats, "}\textcolor{stringliteral}{", "}lua::message floats\textcolor{stringliteral}{");}
\textcolor{stringliteral}{            else}
\textcolor{stringliteral}{               print("}lua::message \textcolor{stringliteral}{" .. ... );}
\textcolor{stringliteral}{            end}
\textcolor{stringliteral}{         end}
\textcolor{stringliteral}{}
\textcolor{stringliteral}{         function signal (sig, src)}
\textcolor{stringliteral}{            print("}lua::signal sig= \textcolor{stringliteral}{" .. sig .. "} src= \textcolor{stringliteral}{" .. src);}
\textcolor{stringliteral}{         end}
\textcolor{stringliteral}{      \}}
\textcolor{stringliteral}{   \}}
\textcolor{stringliteral}{}
\textcolor{stringliteral}{   // The group name NEEDS a / in it, }
\textcolor{stringliteral}{   // or the part below that tries to swallow it won't work.}
\textcolor{stringliteral}{   // Leaving just the lua part visible.}
\textcolor{stringliteral}{   group \{}
\textcolor{stringliteral}{      name: "}bubbles/lua\textcolor{stringliteral}{";}
\textcolor{stringliteral}{      lua\_script\_only: 1;}
\textcolor{stringliteral}{      lua\_script \{}
\textcolor{stringliteral}{         local bubbles = \{ \};}
\textcolor{stringliteral}{         local bubbleCols = 8;}
\textcolor{stringliteral}{         local bubbleRows = 6;}
\textcolor{stringliteral}{}
\textcolor{stringliteral}{         for i = 1, bubbleRows do}
\textcolor{stringliteral}{            row = \{ \};}
\textcolor{stringliteral}{            for j = 1, bubbleCols do}
\textcolor{stringliteral}{               image = edje.image();}
\textcolor{stringliteral}{               image:image("}bubble.png\textcolor{stringliteral}{");}
\textcolor{stringliteral}{               image:show();}
\textcolor{stringliteral}{               table.insert(row, image);}
\textcolor{stringliteral}{            end}
\textcolor{stringliteral}{            table.insert(bubbles, row);}
\textcolor{stringliteral}{         end}
\textcolor{stringliteral}{}
\textcolor{stringliteral}{         function resize (w, h)}
\textcolor{stringliteral}{            for i = 1, bubbleRows do}
\textcolor{stringliteral}{               for j = 1, bubbleCols do}
\textcolor{stringliteral}{                  w1 = w / bubbleCols;}
\textcolor{stringliteral}{                  h1 = h / bubbleRows;}
\textcolor{stringliteral}{                  bubbles[i][j]:geom((j - 1) * w1, (i - 1) * h1, w1, h1);}
\textcolor{stringliteral}{                  if ((1 == i) or (1 == j) or (bubbleRows == i) or (bubbleCols == j)) then}
\textcolor{stringliteral}{                     bubbles[i][j]:color(0, 255, 0, 200);}
\textcolor{stringliteral}{                  else}
\textcolor{stringliteral}{                     bubbles[i][j]:color(math.random(200) + 55, 0, math.random(255) + 55, 200);}
\textcolor{stringliteral}{                  end}
\textcolor{stringliteral}{               end}
\textcolor{stringliteral}{            end}
\textcolor{stringliteral}{         end}
\textcolor{stringliteral}{      \}}
\textcolor{stringliteral}{   \}}
\textcolor{stringliteral}{}
\textcolor{stringliteral}{   group \{}
\textcolor{stringliteral}{      name: "}plain/edje/group\textcolor{stringliteral}{";}
\textcolor{stringliteral}{      parts \{}
\textcolor{stringliteral}{         part \{}
\textcolor{stringliteral}{            name: "}background\textcolor{stringliteral}{";}
\textcolor{stringliteral}{            type: RECT;}
\textcolor{stringliteral}{            mouse\_events: 0;}
\textcolor{stringliteral}{            description \{}
\textcolor{stringliteral}{               state: "}\textcolor{keywordflow}{default}\textcolor{stringliteral}{" 0.0;}
\textcolor{stringliteral}{               color: 0 0 0 255;}
\textcolor{stringliteral}{            \}}
\textcolor{stringliteral}{         \}}
\textcolor{stringliteral}{}
\textcolor{stringliteral}{         // A lua group embedded in an edje group.}
\textcolor{stringliteral}{         part \{}
\textcolor{stringliteral}{            name: "}bubbles\_lua\textcolor{stringliteral}{";}
\textcolor{stringliteral}{            type: GROUP;}
\textcolor{stringliteral}{            source: "}bubbles/lua\textcolor{stringliteral}{";}
\textcolor{stringliteral}{            mouse\_events: 0;}
\textcolor{stringliteral}{            description \{ state: "}\textcolor{keywordflow}{default}\textcolor{stringliteral}{" 0.0; \}}
\textcolor{stringliteral}{         \}}
\textcolor{stringliteral}{}
\textcolor{stringliteral}{         part \{}
\textcolor{stringliteral}{            name: "}background\_image\textcolor{stringliteral}{";}
\textcolor{stringliteral}{            type: IMAGE;}
\textcolor{stringliteral}{            mouse\_events: 0;}
\textcolor{stringliteral}{            description \{}
\textcolor{stringliteral}{               state: "}\textcolor{keywordflow}{default}\textcolor{stringliteral}{" 0.0;}
\textcolor{stringliteral}{               aspect\_preference: HORIZONTAL;}
\textcolor{stringliteral}{               color\_class: "}test\_colour\textcolor{stringliteral}{";}
\textcolor{stringliteral}{               image \{ normal: "}test.png\textcolor{stringliteral}{"; \}}
\textcolor{stringliteral}{            \}}
\textcolor{stringliteral}{         \}}
\textcolor{stringliteral}{}
\textcolor{stringliteral}{         part \{}
\textcolor{stringliteral}{            name: "}some\_text\textcolor{stringliteral}{";}
\textcolor{stringliteral}{            type: TEXT;}
\textcolor{stringliteral}{            mouse\_events: 0;}
\textcolor{stringliteral}{            description \{}
\textcolor{stringliteral}{               state: "}\textcolor{keywordflow}{default}\textcolor{stringliteral}{" 0;}
\textcolor{stringliteral}{               text}
\textcolor{stringliteral}{               \{}
\textcolor{stringliteral}{                  text: "}This is test text.\textcolor{stringliteral}{";}
\textcolor{stringliteral}{                  text\_class: "}test\_text\_class\textcolor{stringliteral}{";}
\textcolor{stringliteral}{               \}}
\textcolor{stringliteral}{            \}}
\textcolor{stringliteral}{         \}}
\textcolor{stringliteral}{}
\textcolor{stringliteral}{      \}}
\textcolor{stringliteral}{   \}}
\textcolor{stringliteral}{}
\textcolor{stringliteral}{\}}
\textcolor{stringliteral}{}
\end{DoxyCodeInclude}
 