aboutsummaryrefslogtreecommitdiff
path: root/lua.c
diff options
context:
space:
mode:
Diffstat (limited to 'lua.c')
-rw-r--r--lua.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/lua.c b/lua.c
index 3f4fc9f7..3107a674 100644
--- a/lua.c
+++ b/lua.c
@@ -207,12 +207,12 @@ static int dochunk (lua_State *L, int status) {
207 207
208 208
209static int dofile (lua_State *L, const char *name) { 209static int dofile (lua_State *L, const char *name) {
210 return dochunk(L, luaL_loadfile(L, name)); 210 return dochunk(L, luaL_loadfilex(L, name, "bt"));
211} 211}
212 212
213 213
214static int dostring (lua_State *L, const char *s, const char *name) { 214static int dostring (lua_State *L, const char *s, const char *name) {
215 return dochunk(L, luaL_loadbuffer(L, s, strlen(s), name)); 215 return dochunk(L, luaL_loadbufferx(L, s, strlen(s), name, "t"));
216} 216}
217 217
218 218
@@ -266,7 +266,7 @@ static int handle_script (lua_State *L, char **argv) {
266 const char *fname = argv[0]; 266 const char *fname = argv[0];
267 if (strcmp(fname, "-") == 0 && strcmp(argv[-1], "--") != 0) 267 if (strcmp(fname, "-") == 0 && strcmp(argv[-1], "--") != 0)
268 fname = NULL; /* stdin */ 268 fname = NULL; /* stdin */
269 status = luaL_loadfile(L, fname); 269 status = luaL_loadfilex(L, fname, "bt");
270 if (status == LUA_OK) { 270 if (status == LUA_OK) {
271 int n = pushargs(L); /* push arguments to script */ 271 int n = pushargs(L); /* push arguments to script */
272 status = docall(L, n, LUA_MULTRET); 272 status = docall(L, n, LUA_MULTRET);
@@ -609,11 +609,11 @@ static int pushline (lua_State *L, int firstline) {
609static int addreturn (lua_State *L) { 609static int addreturn (lua_State *L) {
610 const char *line = lua_tostring(L, -1); /* original line */ 610 const char *line = lua_tostring(L, -1); /* original line */
611 const char *retline = lua_pushfstring(L, "return %s;", line); 611 const char *retline = lua_pushfstring(L, "return %s;", line);
612 int status = luaL_loadbuffer(L, retline, strlen(retline), "=stdin"); 612 int status = luaL_loadbufferx(L, retline, strlen(retline), "=stdin", "t");
613 if (status == LUA_OK) 613 if (status == LUA_OK)
614 lua_remove(L, -2); /* remove modified line */ 614 lua_remove(L, -2); /* remove modified line */
615 else 615 else
616 lua_pop(L, 2); /* pop result from 'luaL_loadbuffer' and modified line */ 616 lua_pop(L, 2); /* pop result from 'luaL_loadbufferx' and modified line */
617 return status; 617 return status;
618} 618}
619 619
@@ -640,7 +640,7 @@ static int multiline (lua_State *L) {
640 const char *line = lua_tolstring(L, 1, &len); /* get first line */ 640 const char *line = lua_tolstring(L, 1, &len); /* get first line */
641 checklocal(line); 641 checklocal(line);
642 for (;;) { /* repeat until gets a complete statement */ 642 for (;;) { /* repeat until gets a complete statement */
643 int status = luaL_loadbuffer(L, line, len, "=stdin"); /* try it */ 643 int status = luaL_loadbufferx(L, line, len, "=stdin", "t"); /* try it */
644 if (!incomplete(L, status) || !pushline(L, 0)) 644 if (!incomplete(L, status) || !pushline(L, 0))
645 return status; /* should not or cannot try to add continuation line */ 645 return status; /* should not or cannot try to add continuation line */
646 lua_remove(L, -2); /* remove error message (from incomplete line) */ 646 lua_remove(L, -2); /* remove error message (from incomplete line) */