summaryrefslogtreecommitdiff
path: root/src/lib/elua/elua.c
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@samsung.com>2015-04-08 16:43:14 +0100
committerDaniel Kolesa <d.kolesa@osg.samsung.com>2015-05-06 15:05:19 +0100
commited3f24943f17dbc2459572ccdde34e62eaf945eb (patch)
tree1e2e9786c2d3981f8b1b66ed87eea462ee5023f8 /src/lib/elua/elua.c
parent098f2ad4cd53c13d52e9496de98ed30966479aad (diff)
elua lib: add elua_state_dirs_set
Diffstat (limited to '')
-rw-r--r--src/lib/elua/elua.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/lib/elua/elua.c b/src/lib/elua/elua.c
index 6601953f27..3446ac4cd2 100644
--- a/src/lib/elua/elua.c
+++ b/src/lib/elua/elua.c
@@ -69,7 +69,7 @@ elua_state_new(void)
69 lua_State *L = luaL_newstate(); 69 lua_State *L = luaL_newstate();
70 if (!L) 70 if (!L)
71 return NULL; 71 return NULL;
72 ret = malloc(sizeof(Elua_State)); 72 ret = calloc(1, sizeof(Elua_State));
73 ret->luastate = L; 73 ret->luastate = L;
74 luaL_openlibs(L); 74 luaL_openlibs(L);
75 lua_pushlightuserdata(L, ret); 75 lua_pushlightuserdata(L, ret);
@@ -82,9 +82,22 @@ elua_state_free(Elua_State *es)
82{ 82{
83 if (!es) return; 83 if (!es) return;
84 if (es->luastate) lua_close(es->luastate); 84 if (es->luastate) lua_close(es->luastate);
85 eina_stringshare_del(es->coredir);
86 eina_stringshare_del(es->moddir);
87 eina_stringshare_del(es->appsdir);
85 free(es); 88 free(es);
86} 89}
87 90
91EAPI void
92elua_state_dirs_set(Elua_State *es, const char *core, const char *mods,
93 const char *apps)
94{
95 if (!es) return;
96 if (core) es->coredir = eina_stringshare_add(core);
97 if (mods) es->moddir = eina_stringshare_add(mods);
98 if (apps) es->appsdir = eina_stringshare_add(apps);
99}
100
88EAPI Elua_State * 101EAPI Elua_State *
89elua_state_from_lua_get(lua_State *L) 102elua_state_from_lua_get(lua_State *L)
90{ 103{