summaryrefslogtreecommitdiff
path: root/src/lib/elua
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@samsung.com>2015-04-10 12:05:54 +0100
committerDaniel Kolesa <d.kolesa@osg.samsung.com>2015-05-06 15:05:20 +0100
commit18da22a468dcf72fae587a4ebd029b1148130a80 (patch)
treec53a777c96a81d5ecd9d52b2cebca96ece864c87 /src/lib/elua
parent6be9b662fbad73d76690daea3631e0d37c0ae896 (diff)
elua lib: add APIs to retrieve refs to require/appload
Diffstat (limited to 'src/lib/elua')
-rw-r--r--src/lib/elua/Elua.h3
-rw-r--r--src/lib/elua/elua.c20
2 files changed, 23 insertions, 0 deletions
diff --git a/src/lib/elua/Elua.h b/src/lib/elua/Elua.h
index f70af321d0..9814cf2390 100644
--- a/src/lib/elua/Elua.h
+++ b/src/lib/elua/Elua.h
@@ -80,6 +80,9 @@ EAPI Eina_Stringshare *elua_state_apps_dir_get(const Elua_State *es);
80 80
81EAPI void elua_state_include_path_add(Elua_State *es, const char *path); 81EAPI void elua_state_include_path_add(Elua_State *es, const char *path);
82 82
83EAPI Eina_Bool elua_state_require_ref_push(Elua_State *es);
84EAPI Eina_Bool elua_state_appload_ref_push(Elua_State *es);
85
83EAPI lua_State *elua_state_lua_state_get(const Elua_State *es); 86EAPI lua_State *elua_state_lua_state_get(const Elua_State *es);
84 87
85EAPI int elua_report_error(const Elua_State *es, const char *pname, int status); 88EAPI int elua_report_error(const Elua_State *es, const char *pname, int status);
diff --git a/src/lib/elua/elua.c b/src/lib/elua/elua.c
index 9019fef565..9299b8ff6e 100644
--- a/src/lib/elua/elua.c
+++ b/src/lib/elua/elua.c
@@ -179,6 +179,26 @@ elua_state_include_path_add(Elua_State *es, const char *path)
179 es->lincs = eina_list_append(es->lincs, eina_stringshare_add(path)); 179 es->lincs = eina_list_append(es->lincs, eina_stringshare_add(path));
180} 180}
181 181
182EAPI Eina_Bool
183elua_state_require_ref_push(Elua_State *es)
184{
185 EINA_SAFETY_ON_NULL_RETURN_VAL(es, EINA_FALSE);
186 EINA_SAFETY_ON_NULL_RETURN_VAL(es->luastate, EINA_FALSE);
187 EINA_SAFETY_ON_FALSE_RETURN_VAL(es->requireref != LUA_REFNIL, EINA_FALSE);
188 lua_rawgeti(es->luastate, LUA_REGISTRYINDEX, es->requireref);
189 return EINA_TRUE;
190}
191
192EAPI Eina_Bool
193elua_state_appload_ref_push(Elua_State *es)
194{
195 EINA_SAFETY_ON_NULL_RETURN_VAL(es, EINA_FALSE);
196 EINA_SAFETY_ON_NULL_RETURN_VAL(es->luastate, EINA_FALSE);
197 EINA_SAFETY_ON_FALSE_RETURN_VAL(es->apploadref != LUA_REFNIL, EINA_FALSE);
198 lua_rawgeti(es->luastate, LUA_REGISTRYINDEX, es->apploadref);
199 return EINA_TRUE;
200}
201
182EAPI lua_State * 202EAPI lua_State *
183elua_state_lua_state_get(const Elua_State *es) 203elua_state_lua_state_get(const Elua_State *es)
184{ 204{