aboutsummaryrefslogtreecommitdiff
path: root/lbuiltin.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>1998-06-19 15:47:06 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>1998-06-19 15:47:06 -0300
commitdf0df08bc537d4f2c13446fee20f8a4335f9d9d2 (patch)
tree9ddf500c4019037c2a2b80f9d94709c28258f30a /lbuiltin.c
parent9618aaf07d0d82ccbac91db22cb42451ec17d7ed (diff)
downloadlua-df0df08bc537d4f2c13446fee20f8a4335f9d9d2.tar.gz
lua-df0df08bc537d4f2c13446fee20f8a4335f9d9d2.tar.bz2
lua-df0df08bc537d4f2c13446fee20f8a4335f9d9d2.zip
"dostring" accepts chunk name.
Diffstat (limited to 'lbuiltin.c')
-rw-r--r--lbuiltin.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/lbuiltin.c b/lbuiltin.c
index 35053865..c555ddf9 100644
--- a/lbuiltin.c
+++ b/lbuiltin.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lbuiltin.c,v 1.29 1998/06/05 22:17:44 roberto Exp roberto $ 2** $Id: lbuiltin.c,v 1.30 1998/06/19 16:14:09 roberto Exp roberto $
3** Built-in functions 3** Built-in functions
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -22,6 +22,7 @@
22#include "ltable.h" 22#include "ltable.h"
23#include "ltm.h" 23#include "ltm.h"
24#include "lua.h" 24#include "lua.h"
25#include "lundump.h"
25 26
26 27
27 28
@@ -114,9 +115,11 @@ static void foreach (void)
114 115
115static void internaldostring (void) 116static void internaldostring (void)
116{ 117{
117 if (lua_getparam(2) != LUA_NOOBJECT) 118 long l;
118 lua_error("invalid 2nd argument (probably obsolete code)"); 119 char *s = luaL_check_lstr(1, &l);
119 if (lua_dostring(luaL_check_string(1)) == 0) 120 if (*s == ID_CHUNK)
121 lua_error("`dostring' cannot run pre-compiled code");
122 if (lua_dobuffer(s, l, luaL_opt_string(2, NULL)) == 0)
120 if (luaA_passresults() == 0) 123 if (luaA_passresults() == 0)
121 lua_pushuserdata(NULL); /* at least one result to signal no errors */ 124 lua_pushuserdata(NULL); /* at least one result to signal no errors */
122} 125}