summaryrefslogtreecommitdiff
path: root/src/bin/elua
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@samsung.com>2015-04-09 13:48:06 +0100
committerDaniel Kolesa <d.kolesa@osg.samsung.com>2015-05-06 15:05:19 +0100
commit128aa3a1ea2fb392e03adeec0179aad4211394a7 (patch)
tree028ad639a20d752bd934e03e84dab09f4b3e4e05 /src/bin/elua
parente4baa1bc124b7706b2ccc04e01377075ab313a2e (diff)
elua lib: elua_io_loadfile now uses Elua_State
Diffstat (limited to 'src/bin/elua')
-rw-r--r--src/bin/elua/main.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/bin/elua/main.c b/src/bin/elua/main.c
index 7c0784069d..cdd88f79af 100644
--- a/src/bin/elua/main.c
+++ b/src/bin/elua/main.c
@@ -203,7 +203,7 @@ static int
203elua_dofile(Elua_State *es, const char *fname) 203elua_dofile(Elua_State *es, const char *fname)
204{ 204{
205 return elua_report_error(es, elua_progname, 205 return elua_report_error(es, elua_progname,
206 elua_io_loadfile(es->luastate, fname) 206 elua_io_loadfile(es, fname)
207 || elua_docall(es, 0, 1)); 207 || elua_docall(es, 0, 1));
208} 208}
209 209
@@ -236,10 +236,9 @@ static int
236elua_doscript(Elua_State *es, int argc, char **argv, int n, int *quit) 236elua_doscript(Elua_State *es, int argc, char **argv, int n, int *quit)
237{ 237{
238 int status; 238 int status;
239 lua_State *L = es->luastate;
240 const char *fname = argv[n]; 239 const char *fname = argv[n];
241 int narg = elua_getargs(es, argc, argv, n); 240 int narg = elua_getargs(es, argc, argv, n);
242 lua_setglobal(L, "arg"); 241 lua_setglobal(es->luastate, "arg");
243 if (fname[0] == '-' && !fname[1]) 242 if (fname[0] == '-' && !fname[1])
244 { 243 {
245 fname = NULL; 244 fname = NULL;
@@ -251,28 +250,28 @@ elua_doscript(Elua_State *es, int argc, char **argv, int n, int *quit)
251 if (f) 250 if (f)
252 { 251 {
253 fclose(f); 252 fclose(f);
254 status = elua_io_loadfile(L, fname); 253 status = elua_io_loadfile(es, fname);
255 } 254 }
256 else 255 else
257 status = !elua_loadapp(es, fname); 256 status = !elua_loadapp(es, fname);
258 } 257 }
259 else 258 else
260 { 259 {
261 status = elua_io_loadfile(L, fname); 260 status = elua_io_loadfile(es, fname);
262 } 261 }
263 lua_insert(L, -(narg + 1)); 262 lua_insert(es->luastate, -(narg + 1));
264 if (!status) 263 if (!status)
265 { 264 {
266 status = elua_docall(es, narg, 1); 265 status = elua_docall(es, narg, 1);
267 } 266 }
268 else 267 else
269 { 268 {
270 lua_pop(L, narg); 269 lua_pop(es->luastate, narg);
271 } 270 }
272 if (!status) 271 if (!status)
273 { 272 {
274 *quit = lua_toboolean(L, -1); 273 *quit = lua_toboolean(es->luastate, -1);
275 lua_pop(L, 1); 274 lua_pop(es->luastate, 1);
276 } 275 }
277 return elua_report_error(es, elua_progname, status); 276 return elua_report_error(es, elua_progname, status);
278} 277}
@@ -434,7 +433,7 @@ elua_main(lua_State *L)
434 } 433 }
435 } 434 }
436 snprintf(modfile, sizeof(modfile), "%s/module.lua", coref); 435 snprintf(modfile, sizeof(modfile), "%s/module.lua", coref);
437 if (elua_report_error(es, elua_progname, elua_io_loadfile(L, modfile))) 436 if (elua_report_error(es, elua_progname, elua_io_loadfile(es, modfile)))
438 { 437 {
439 m->status = 1; 438 m->status = 1;
440 return 0; 439 return 0;
@@ -447,7 +446,7 @@ elua_main(lua_State *L)
447 lua_call(L, 2, 0); 446 lua_call(L, 2, 0);
448 447
449 snprintf(modfile, sizeof(modfile), "%s/gettext.lua", coref); 448 snprintf(modfile, sizeof(modfile), "%s/gettext.lua", coref);
450 if (elua_report_error(es, elua_progname, elua_io_loadfile(L, modfile))) 449 if (elua_report_error(es, elua_progname, elua_io_loadfile(es, modfile)))
451 { 450 {
452 m->status = 1; 451 m->status = 1;
453 return 0; 452 return 0;