aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2014-11-12 11:28:54 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2014-11-12 11:28:54 -0200
commite5fd1e5fe25418210c1773e59491c4660f872ba4 (patch)
tree34cadaa56756def4e8cddaf06ee600af7975012d
parent87b179e71d7b3b6d1432b7500e6f77596e85e773 (diff)
downloadlua-e5fd1e5fe25418210c1773e59491c4660f872ba4.tar.gz
lua-e5fd1e5fe25418210c1773e59491c4660f872ba4.tar.bz2
lua-e5fd1e5fe25418210c1773e59491c4660f872ba4.zip
details (match parameter names with lua.h and manual)
-rw-r--r--lapi.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/lapi.c b/lapi.c
index d6f448c2..efa9a5a4 100644
--- a/lapi.c
+++ b/lapi.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lapi.c,v 2.241 2014/10/31 17:41:51 roberto Exp roberto $ 2** $Id: lapi.c,v 2.242 2014/11/02 19:19:04 roberto Exp roberto $
3** Lua API 3** Lua API
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -94,22 +94,22 @@ static void growstack (lua_State *L, void *ud) {
94} 94}
95 95
96 96
97LUA_API int lua_checkstack (lua_State *L, int size) { 97LUA_API int lua_checkstack (lua_State *L, int n) {
98 int res; 98 int res;
99 CallInfo *ci = L->ci; 99 CallInfo *ci = L->ci;
100 lua_lock(L); 100 lua_lock(L);
101 api_check(size >= 0, "negative 'size'"); 101 api_check(n >= 0, "negative 'n'");
102 if (L->stack_last - L->top > size) /* stack large enough? */ 102 if (L->stack_last - L->top > n) /* stack large enough? */
103 res = 1; /* yes; check is OK */ 103 res = 1; /* yes; check is OK */
104 else { /* no; need to grow stack */ 104 else { /* no; need to grow stack */
105 int inuse = cast_int(L->top - L->stack) + EXTRA_STACK; 105 int inuse = cast_int(L->top - L->stack) + EXTRA_STACK;
106 if (inuse > LUAI_MAXSTACK - size) /* can grow without overflow? */ 106 if (inuse > LUAI_MAXSTACK - n) /* can grow without overflow? */
107 res = 0; /* no */ 107 res = 0; /* no */
108 else /* try to grow stack */ 108 else /* try to grow stack */
109 res = (luaD_rawrunprotected(L, &growstack, &size) == LUA_OK); 109 res = (luaD_rawrunprotected(L, &growstack, &n) == LUA_OK);
110 } 110 }
111 if (res && ci->top < L->top + size) 111 if (res && ci->top < L->top + n)
112 ci->top = L->top + size; /* adjust frame top */ 112 ci->top = L->top + n; /* adjust frame top */
113 lua_unlock(L); 113 lua_unlock(L);
114 return res; 114 return res;
115} 115}
@@ -578,12 +578,12 @@ LUA_API int lua_pushthread (lua_State *L) {
578*/ 578*/
579 579
580 580
581LUA_API int lua_getglobal (lua_State *L, const char *var) { 581LUA_API int lua_getglobal (lua_State *L, const char *name) {
582 Table *reg = hvalue(&G(L)->l_registry); 582 Table *reg = hvalue(&G(L)->l_registry);
583 const TValue *gt; /* global table */ 583 const TValue *gt; /* global table */
584 lua_lock(L); 584 lua_lock(L);
585 gt = luaH_getint(reg, LUA_RIDX_GLOBALS); 585 gt = luaH_getint(reg, LUA_RIDX_GLOBALS);
586 setsvalue2s(L, L->top++, luaS_new(L, var)); 586 setsvalue2s(L, L->top++, luaS_new(L, name));
587 luaV_gettable(L, gt, L->top - 1, L->top - 1); 587 luaV_gettable(L, gt, L->top - 1, L->top - 1);
588 lua_unlock(L); 588 lua_unlock(L);
589 return ttnov(L->top - 1); 589 return ttnov(L->top - 1);
@@ -718,13 +718,13 @@ LUA_API int lua_getuservalue (lua_State *L, int idx) {
718*/ 718*/
719 719
720 720
721LUA_API void lua_setglobal (lua_State *L, const char *var) { 721LUA_API void lua_setglobal (lua_State *L, const char *name) {
722 Table *reg = hvalue(&G(L)->l_registry); 722 Table *reg = hvalue(&G(L)->l_registry);
723 const TValue *gt; /* global table */ 723 const TValue *gt; /* global table */
724 lua_lock(L); 724 lua_lock(L);
725 api_checknelems(L, 1); 725 api_checknelems(L, 1);
726 gt = luaH_getint(reg, LUA_RIDX_GLOBALS); 726 gt = luaH_getint(reg, LUA_RIDX_GLOBALS);
727 setsvalue2s(L, L->top++, luaS_new(L, var)); 727 setsvalue2s(L, L->top++, luaS_new(L, name));
728 luaV_settable(L, gt, L->top - 1, L->top - 2); 728 luaV_settable(L, gt, L->top - 1, L->top - 2);
729 L->top -= 2; /* pop value and key */ 729 L->top -= 2; /* pop value and key */
730 lua_unlock(L); 730 lua_unlock(L);