diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2009-12-17 14:20:01 -0200 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2009-12-17 14:20:01 -0200 |
| commit | c3a6f3fa1c6360d4ea2e32f9415f51e8e55093b4 (patch) | |
| tree | 9f26c632fa0215c21260a81f6fad1a79678f8173 /lua.c | |
| parent | 0bbdddc86b1353fec36ae886b4142986f3c4713f (diff) | |
| download | lua-c3a6f3fa1c6360d4ea2e32f9415f51e8e55093b4.tar.gz lua-c3a6f3fa1c6360d4ea2e32f9415f51e8e55093b4.tar.bz2 lua-c3a6f3fa1c6360d4ea2e32f9415f51e8e55093b4.zip | |
'lua_objlen' replaced by 'lua_rawlen', 'lua_len', and 'luaL_len'
Diffstat (limited to 'lua.c')
| -rw-r--r-- | lua.c | 8 |
1 files changed, 5 insertions, 3 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lua.c,v 1.178 2009/12/17 12:26:09 roberto Exp roberto $ | 2 | ** $Id: lua.c,v 1.179 2009/12/17 13:07:41 roberto Exp roberto $ |
| 3 | ** Lua stand-alone interpreter | 3 | ** Lua stand-alone interpreter |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -65,7 +65,7 @@ | |||
| 65 | #include <readline/history.h> | 65 | #include <readline/history.h> |
| 66 | #define lua_readline(L,b,p) ((void)L, ((b)=readline(p)) != NULL) | 66 | #define lua_readline(L,b,p) ((void)L, ((b)=readline(p)) != NULL) |
| 67 | #define lua_saveline(L,idx) \ | 67 | #define lua_saveline(L,idx) \ |
| 68 | if (lua_objlen(L,idx) > 0) /* non-empty line? */ \ | 68 | if (lua_rawlen(L,idx) > 0) /* non-empty line? */ \ |
| 69 | add_history(lua_tostring(L, idx)); /* add it to history */ | 69 | add_history(lua_tostring(L, idx)); /* add it to history */ |
| 70 | #define lua_freeline(L,b) ((void)L, free(b)) | 70 | #define lua_freeline(L,b) ((void)L, free(b)) |
| 71 | 71 | ||
| @@ -271,7 +271,9 @@ static int loadline (lua_State *L) { | |||
| 271 | if (!pushline(L, 1)) | 271 | if (!pushline(L, 1)) |
| 272 | return -1; /* no input */ | 272 | return -1; /* no input */ |
| 273 | for (;;) { /* repeat until gets a complete line */ | 273 | for (;;) { /* repeat until gets a complete line */ |
| 274 | status = luaL_loadbuffer(L, lua_tostring(L, 1), lua_objlen(L, 1), "=stdin"); | 274 | size_t l; |
| 275 | const char *line = lua_tolstring(L, 1, &l); | ||
| 276 | status = luaL_loadbuffer(L, line, l, "=stdin"); | ||
| 275 | if (!incomplete(L, status)) break; /* cannot try to add lines? */ | 277 | if (!incomplete(L, status)) break; /* cannot try to add lines? */ |
| 276 | if (!pushline(L, 0)) /* no more input? */ | 278 | if (!pushline(L, 0)) /* no more input? */ |
| 277 | return -1; | 279 | return -1; |
