mirror of
https://github.com/lua/lua
synced 2024-11-22 21:01:26 +03:00
lua_setfenv/lua_getfenv should also manipulate threads
This commit is contained in:
parent
7f97ec286e
commit
b3f7a43019
8
lapi.c
8
lapi.c
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: lapi.c,v 2.43 2005/05/31 14:34:02 roberto Exp roberto $
|
||||
** $Id: lapi.c,v 2.44 2005/07/05 14:30:31 roberto Exp roberto $
|
||||
** Lua API
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@ -618,6 +618,9 @@ LUA_API void lua_getfenv (lua_State *L, int idx) {
|
||||
case LUA_TUSERDATA:
|
||||
sethvalue(L, L->top, uvalue(o)->env);
|
||||
break;
|
||||
case LUA_TTHREAD:
|
||||
setobj2s(L, L->top, gt(thvalue(o)));
|
||||
break;
|
||||
default:
|
||||
setnilvalue(L->top);
|
||||
break;
|
||||
@ -736,6 +739,9 @@ LUA_API int lua_setfenv (lua_State *L, int idx) {
|
||||
case LUA_TUSERDATA:
|
||||
uvalue(o)->env = hvalue(L->top - 1);
|
||||
break;
|
||||
case LUA_TTHREAD:
|
||||
sethvalue(L, gt(thvalue(o)), hvalue(L->top - 1));
|
||||
break;
|
||||
default:
|
||||
res = 0;
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user