diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2005-02-18 10:40:02 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2005-02-18 10:40:02 -0200 |
commit | 7d45a5f48ff32a4e09a1734de23823943d6a6b28 (patch) | |
tree | de7bef1faf37d9b639928e5269e89d7112b5b6fa /lstring.c | |
parent | 73d764024451c24bc43b8e5102fe90974a86b7f4 (diff) | |
download | lua-7d45a5f48ff32a4e09a1734de23823943d6a6b28.tar.gz lua-7d45a5f48ff32a4e09a1734de23823943d6a6b28.tar.bz2 lua-7d45a5f48ff32a4e09a1734de23823943d6a6b28.zip |
C functions and userdata also have environments
Diffstat (limited to 'lstring.c')
-rw-r--r-- | lstring.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lstring.c,v 2.5 2004/11/24 19:16:03 roberto Exp $ | 2 | ** $Id: lstring.c,v 2.6 2005/01/18 17:18:09 roberto Exp roberto $ |
3 | ** String table (keeps all strings handled by Lua) | 3 | ** String table (keeps all strings handled by Lua) |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -93,7 +93,7 @@ TString *luaS_newlstr (lua_State *L, const char *str, size_t l) { | |||
93 | } | 93 | } |
94 | 94 | ||
95 | 95 | ||
96 | Udata *luaS_newudata (lua_State *L, size_t s) { | 96 | Udata *luaS_newudata (lua_State *L, size_t s, Table *e) { |
97 | Udata *u; | 97 | Udata *u; |
98 | if (s > MAX_SIZET - sizeof(Udata)) | 98 | if (s > MAX_SIZET - sizeof(Udata)) |
99 | luaM_toobig(L); | 99 | luaM_toobig(L); |
@@ -102,6 +102,7 @@ Udata *luaS_newudata (lua_State *L, size_t s) { | |||
102 | u->uv.tt = LUA_TUSERDATA; | 102 | u->uv.tt = LUA_TUSERDATA; |
103 | u->uv.len = s; | 103 | u->uv.len = s; |
104 | u->uv.metatable = NULL; | 104 | u->uv.metatable = NULL; |
105 | u->uv.env = e; | ||
105 | /* chain it on udata list (after main thread) */ | 106 | /* chain it on udata list (after main thread) */ |
106 | u->uv.next = G(L)->mainthread->next; | 107 | u->uv.next = G(L)->mainthread->next; |
107 | G(L)->mainthread->next = obj2gco(u); | 108 | G(L)->mainthread->next = obj2gco(u); |