aboutsummaryrefslogtreecommitdiff
path: root/lua.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>1999-12-06 09:41:28 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>1999-12-06 09:41:28 -0200
commit968ad49da6522c1cf413bd86323a613176d12c07 (patch)
tree6961b75297c9533963f3b2d7db4f06900ed4f9f7 /lua.c
parent1fdb445e7dae6d08b67e46e1979f285b38bbc18d (diff)
downloadlua-968ad49da6522c1cf413bd86323a613176d12c07.tar.gz
lua-968ad49da6522c1cf413bd86323a613176d12c07.tar.bz2
lua-968ad49da6522c1cf413bd86323a613176d12c07.zip
`lua_newstate' gets the inital stack size and other arguments
Diffstat (limited to 'lua.c')
-rw-r--r--lua.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/lua.c b/lua.c
index d3d716f2..7956ede9 100644
--- a/lua.c
+++ b/lua.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lua.c,v 1.26 1999/11/16 12:50:48 roberto Exp roberto $ 2** $Id: lua.c,v 1.27 1999/11/22 13:12:07 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*/
@@ -91,6 +91,7 @@ static void assign (char *arg) {
91 91
92 92
93static void getargs (int argc, char *argv[]) { 93static void getargs (int argc, char *argv[]) {
94 lua_beginblock(); {
94 int i, j; 95 int i, j;
95 lua_Object args = lua_createtable(); 96 lua_Object args = lua_createtable();
96 lua_pushobject(args); 97 lua_pushobject(args);
@@ -108,6 +109,7 @@ static void getargs (int argc, char *argv[]) {
108 /* arg.nn = minimum index in table `arg' */ 109 /* arg.nn = minimum index in table `arg' */
109 lua_pushobject(args); lua_pushstring("nn"); 110 lua_pushobject(args); lua_pushstring("nn");
110 lua_pushnumber(-i); lua_settable(); 111 lua_pushnumber(-i); lua_settable();
112 } lua_endblock();
111} 113}
112 114
113 115
@@ -146,7 +148,7 @@ static void manual_input (int prompt) {
146 148
147int main (int argc, char *argv[]) { 149int main (int argc, char *argv[]) {
148 int i; 150 int i;
149 lua_open(); 151 lua_state = lua_newstate("stack", 1024, "builtin", 1, NULL);
150 lua_pushstring("> "); lua_setglobal("_PROMPT"); 152 lua_pushstring("> "); lua_setglobal("_PROMPT");
151 lua_userinit(); 153 lua_userinit();
152 getargs(argc, argv); 154 getargs(argc, argv);