diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2009-03-10 14:14:37 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2009-03-10 14:14:37 -0300 |
| commit | ba484b9eb16dd62a7c3a5400a66eb952b654d3f0 (patch) | |
| tree | 31692ddf85265e5a46eab0cd55a0b0757a225e68 /lbaselib.c | |
| parent | f9d015523ef48266cea37e13717c223c16941b23 (diff) | |
| download | lua-ba484b9eb16dd62a7c3a5400a66eb952b654d3f0.tar.gz lua-ba484b9eb16dd62a7c3a5400a66eb952b654d3f0.tar.bz2 lua-ba484b9eb16dd62a7c3a5400a66eb952b654d3f0.zip | |
yielding across lua_call (first version)
Diffstat (limited to 'lbaselib.c')
| -rw-r--r-- | lbaselib.c | 11 |
1 files changed, 8 insertions, 3 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lbaselib.c,v 1.209 2009/02/06 18:38:47 roberto Exp roberto $ | 2 | ** $Id: lbaselib.c,v 1.210 2009/02/07 12:23:15 roberto Exp roberto $ |
| 3 | ** Basic library | 3 | ** Basic library |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -323,12 +323,17 @@ static int luaB_load (lua_State *L) { | |||
| 323 | } | 323 | } |
| 324 | 324 | ||
| 325 | 325 | ||
| 326 | static int dofilecont (lua_State *L) { | ||
| 327 | return lua_gettop(L) - 1; | ||
| 328 | } | ||
| 329 | |||
| 330 | |||
| 326 | static int luaB_dofile (lua_State *L) { | 331 | static int luaB_dofile (lua_State *L) { |
| 327 | const char *fname = luaL_optstring(L, 1, NULL); | 332 | const char *fname = luaL_optstring(L, 1, NULL); |
| 328 | lua_settop(L, 1); | 333 | lua_settop(L, 1); |
| 329 | if (luaL_loadfile(L, fname) != LUA_OK) lua_error(L); | 334 | if (luaL_loadfile(L, fname) != LUA_OK) lua_error(L); |
| 330 | lua_call(L, 0, LUA_MULTRET); | 335 | lua_callcont(L, 0, LUA_MULTRET, dofilecont); |
| 331 | return lua_gettop(L) - 1; | 336 | return dofilecont(L); |
| 332 | } | 337 | } |
| 333 | 338 | ||
| 334 | 339 | ||
