diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2010-05-31 13:08:55 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2010-05-31 13:08:55 -0300 |
| commit | bd619b931173fc35f38dfbb07746bcdc5ef11808 (patch) | |
| tree | 2fdcf32609e853c0490af52a9590a40982749a8e /lapi.c | |
| parent | aca84ee1a04987f7cfe8c4e4126c953351d1216f (diff) | |
| download | lua-bd619b931173fc35f38dfbb07746bcdc5ef11808.tar.gz lua-bd619b931173fc35f38dfbb07746bcdc5ef11808.tar.bz2 lua-bd619b931173fc35f38dfbb07746bcdc5ef11808.zip | |
new macro MAXUPVAL (maximum number of upvalues per closure)
Diffstat (limited to 'lapi.c')
| -rw-r--r-- | lapi.c | 6 |
1 files changed, 3 insertions, 3 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lapi.c,v 2.128 2010/05/12 14:09:20 roberto Exp roberto $ | 2 | ** $Id: lapi.c,v 2.129 2010/05/14 13:15:26 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 | */ |
| @@ -55,7 +55,7 @@ static TValue *index2addr (lua_State *L, int idx) { | |||
| 55 | return &G(L)->l_registry; | 55 | return &G(L)->l_registry; |
| 56 | else { /* upvalues */ | 56 | else { /* upvalues */ |
| 57 | idx = LUA_REGISTRYINDEX - idx; | 57 | idx = LUA_REGISTRYINDEX - idx; |
| 58 | api_check(L, idx <= UCHAR_MAX + 1, "upvalue index too large"); | 58 | api_check(L, idx <= MAXUPVAL + 1, "upvalue index too large"); |
| 59 | if (ttislcf(ci->func)) /* light C function? */ | 59 | if (ttislcf(ci->func)) /* light C function? */ |
| 60 | return cast(TValue *, luaO_nilobject); /* it has no upvalues */ | 60 | return cast(TValue *, luaO_nilobject); /* it has no upvalues */ |
| 61 | else { | 61 | else { |
| @@ -507,7 +507,7 @@ LUA_API void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n) { | |||
| 507 | else { | 507 | else { |
| 508 | Closure *cl; | 508 | Closure *cl; |
| 509 | api_checknelems(L, n); | 509 | api_checknelems(L, n); |
| 510 | api_check(L, n <= UCHAR_MAX, "upvalue index too large"); | 510 | api_check(L, n <= MAXUPVAL, "upvalue index too large"); |
| 511 | luaC_checkGC(L); | 511 | luaC_checkGC(L); |
| 512 | cl = luaF_newCclosure(L, n); | 512 | cl = luaF_newCclosure(L, n); |
| 513 | cl->c.f = fn; | 513 | cl->c.f = fn; |
