summaryrefslogtreecommitdiff
path: root/src/lib/elua
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@samsung.com>2015-04-08 14:52:06 +0100
committerDaniel Kolesa <d.kolesa@osg.samsung.com>2015-05-06 15:05:18 +0100
commitcf98f846e90f3c48da7514f3f612bf4e351db5c5 (patch)
treed01ce46c86ebfb593a5480a0ac261ee50360c626 /src/lib/elua
parent17a54ff8e0b7c4430c510713ec636160175dbea8 (diff)
elua lib: Elua_State for elua_state_setup_i18n
Diffstat (limited to 'src/lib/elua')
-rw-r--r--src/lib/elua/Elua.h4
-rw-r--r--src/lib/elua/elua.c22
2 files changed, 13 insertions, 13 deletions
diff --git a/src/lib/elua/Elua.h b/src/lib/elua/Elua.h
index 623c9925b8..2b06a805c0 100644
--- a/src/lib/elua/Elua.h
+++ b/src/lib/elua/Elua.h
@@ -67,13 +67,13 @@ EAPI int elua_init(void);
67EAPI int elua_shutdown(void); 67EAPI int elua_shutdown(void);
68 68
69EAPI Elua_State *elua_state_new(void); 69EAPI Elua_State *elua_state_new(void);
70EAPI void elua_state_free(Elua_State *state); 70EAPI void elua_state_free(Elua_State *es);
71 71
72EAPI Elua_State *elua_state_from_lua_get(lua_State *L); 72EAPI Elua_State *elua_state_from_lua_get(lua_State *L);
73 73
74EAPI int elua_report_error(Elua_State *es, const char *pname, int status); 74EAPI int elua_report_error(Elua_State *es, const char *pname, int status);
75 75
76EAPI void elua_state_setup_i18n(lua_State *L); 76EAPI void elua_state_setup_i18n(Elua_State *es);
77 77
78EAPI int elua_io_popen(lua_State *L); 78EAPI int elua_io_popen(lua_State *L);
79EAPI int elua_io_loadfile(lua_State *L, const char *fname); 79EAPI int elua_io_loadfile(lua_State *L, const char *fname);
diff --git a/src/lib/elua/elua.c b/src/lib/elua/elua.c
index 957d4e4bbe..6601953f27 100644
--- a/src/lib/elua/elua.c
+++ b/src/lib/elua/elua.c
@@ -78,11 +78,11 @@ elua_state_new(void)
78} 78}
79 79
80EAPI void 80EAPI void
81elua_state_free(Elua_State *state) 81elua_state_free(Elua_State *es)
82{ 82{
83 if (!state) return; 83 if (!es) return;
84 if (state->luastate) lua_close(state->luastate); 84 if (es->luastate) lua_close(es->luastate);
85 free(state); 85 free(es);
86} 86}
87 87
88EAPI Elua_State * 88EAPI Elua_State *
@@ -153,19 +153,19 @@ const luaL_reg gettextlib[] =
153}; 153};
154 154
155EAPI void 155EAPI void
156elua_state_setup_i18n(lua_State *L) 156elua_state_setup_i18n(Elua_State *es)
157{ 157{
158#ifdef ENABLE_NLS 158#ifdef ENABLE_NLS
159 char *(*dgettextp)(const char*, const char*) = dgettext; 159 char *(*dgettextp)(const char*, const char*) = dgettext;
160 char *(*dngettextp)(const char*, const char*, const char*, unsigned long) 160 char *(*dngettextp)(const char*, const char*, const char*, unsigned long)
161 = dngettext; 161 = dngettext;
162#endif 162#endif
163 lua_createtable(L, 0, 0); 163 lua_createtable(es->luastate, 0, 0);
164 luaL_register(L, NULL, gettextlib); 164 luaL_register(es->luastate, NULL, gettextlib);
165#ifdef ENABLE_NLS 165#ifdef ENABLE_NLS
166 lua_pushlightuserdata(L, *((void**)&dgettextp)); 166 lua_pushlightuserdata(es->luastate, *((void**)&dgettextp));
167 lua_setfield(L, -2, "dgettext"); 167 lua_setfield(es->luastate, -2, "dgettext");
168 lua_pushlightuserdata(L, *((void**)&dngettextp)); 168 lua_pushlightuserdata(es->luastate, *((void**)&dngettextp));
169 lua_setfield(L, -2, "dngettext"); 169 lua_setfield(es->luastate, -2, "dngettext");
170#endif 170#endif
171} 171}