aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/LuaSL
diff options
context:
space:
mode:
authorDavid Walter Seikel2012-02-05 17:38:18 +1000
committerDavid Walter Seikel2012-02-05 17:38:18 +1000
commita04954f2ecdf2da624ba24352981db11fb2b6a14 (patch)
treed2ae1aa925be75041e0b3f768905c595584d9de8 /LuaSL
parentEnable the Lua main loop loopiness, and add a quit option. (diff)
downloadSledjHamr-a04954f2ecdf2da624ba24352981db11fb2b6a14.zip
SledjHamr-a04954f2ecdf2da624ba24352981db11fb2b6a14.tar.gz
SledjHamr-a04954f2ecdf2da624ba24352981db11fb2b6a14.tar.bz2
SledjHamr-a04954f2ecdf2da624ba24352981db11fb2b6a14.tar.xz
Tell the scripts to quit after a short delay.
Diffstat (limited to 'LuaSL')
-rw-r--r--LuaSL/src/LuaSL_main.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/LuaSL/src/LuaSL_main.c b/LuaSL/src/LuaSL_main.c
index f233031..5f48c5e 100644
--- a/LuaSL/src/LuaSL_main.c
+++ b/LuaSL/src/LuaSL_main.c
@@ -109,6 +109,27 @@ static void dirList_run(const char *name, const char *path, void *data)
109 } 109 }
110} 110}
111 111
112static void dirList_quit(const char *name, const char *path, void *data)
113{
114 gameGlobals *game = data;
115 char buf[PATH_MAX];
116 char *ext = rindex(name, '.');
117
118 if (ext)
119 {
120 if (0 == strcmp(ext, ".out"))
121 {
122 const char *status = NULL;
123
124 snprintf(buf, sizeof(buf), "%s/%s.events", path, name);
125// PD("Quitting Lua script %s", buf);
126 status = sendToChannel(buf, "quit()");
127 if (status)
128 PE("Error trying to kill script %s : %s", buf, status);
129 }
130 }
131}
132
112int 133int
113main(int argc, char **argv) 134main(int argc, char **argv)
114{ 135{
@@ -258,6 +279,13 @@ main(int argc, char **argv)
258 ecore_animator_del(ani); 279 ecore_animator_del(ani);
259 ecore_evas_free(game.ee); 280 ecore_evas_free(game.ee);
260 } 281 }
282 else
283 {
284 // Wait awhile, then quit all scripts we started, for testing.
285 sleep(2);
286 snprintf(buf, sizeof(buf), "%s/Test sim/objects", PACKAGE_DATA_DIR);
287 eina_file_dir_list(buf, EINA_TRUE, dirList_quit, &game);
288 }
261 289
262 runnerTearDown(&game); 290 runnerTearDown(&game);
263 edje_shutdown(); 291 edje_shutdown();