From f43dc63f9820ba0d3ff30efd2c45bf6dc5d2af51 Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Sun, 12 Feb 2012 00:08:53 +1000 Subject: New sendBack and sendForth global functions. --- LuaSL/src/LuaSL_test.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) (limited to 'LuaSL/src/LuaSL_test.c') diff --git a/LuaSL/src/LuaSL_test.c b/LuaSL/src/LuaSL_test.c index 90dc5ac..2ca9792 100644 --- a/LuaSL/src/LuaSL_test.c +++ b/LuaSL/src/LuaSL_test.c @@ -89,7 +89,6 @@ static void dirList_compile(const char *name, const char *path, void *data) { gameGlobals *game = data; - char buf[PATH_MAX]; char *ext = rindex(name, '.'); if (ext) @@ -103,9 +102,7 @@ static void dirList_compile(const char *name, const char *path, void *data) snprintf(me->SID, sizeof(me->SID), "%s/%s", path, name); snprintf(me->fileName, sizeof(me->fileName), "%s/%s", path, name); eina_hash_add(game->scripts, me->SID, me); - snprintf(buf, sizeof(buf), "%s/%s.compile()\n", path, name); - ecore_con_server_send(game->server, buf, strlen(buf)); - ecore_con_server_flush(game->server); + sendForth(game, me->SID, "compile()"); } } } @@ -119,11 +116,7 @@ static Eina_Bool _quit_timer_cb(void *data) scripts = eina_hash_iterator_data_new(game->scripts); while(eina_iterator_next(scripts, (void **) &me)) { - char buf[PATH_MAX]; - - snprintf(buf, sizeof(buf), "%s.lua.out.quit()\n", me->SID); - ecore_con_server_send(game->server, buf, strlen(buf)); - ecore_con_server_flush(game->server); + sendForth(game, me->SID, "quit()"); } ecore_con_server_send(game->server, ".exit()\n", 8); @@ -151,7 +144,6 @@ static Eina_Bool _data(void *data, int type __UNUSED__, Ecore_Con_Event_Server_D { gameGlobals *game = data; - char buf[PATH_MAX]; char SID[PATH_MAX]; const char *command; char *ext; @@ -191,9 +183,7 @@ static Eina_Bool _data(void *data, int type __UNUSED__, Ecore_Con_Event_Server_D } } PD("The compile of %s worked, running it now.", SID); - snprintf(buf, sizeof(buf), "%s.lua.out.start()\n", SID); - ecore_con_server_send(game->server, buf, strlen(buf)); - ecore_con_server_flush(game->server); + sendForth(game, SID, "start()"); } else { -- cgit v1.1