diff options
author | Mike Pall <mike> | 2017-04-07 12:38:05 +0200 |
---|---|---|
committer | Mike Pall <mike> | 2017-04-07 12:38:05 +0200 |
commit | 2b8de8cfc6ae483d6ec16b7609bab64e37d6fc02 (patch) | |
tree | 4bd1834a7f4b22d215b9d89a04e33452155e71ec /src/lj_api.c | |
parent | cde968f91f28a4819e15443a5f32c89daddb4c15 (diff) | |
download | luajit-2b8de8cfc6ae483d6ec16b7609bab64e37d6fc02.tar.gz luajit-2b8de8cfc6ae483d6ec16b7609bab64e37d6fc02.tar.bz2 luajit-2b8de8cfc6ae483d6ec16b7609bab64e37d6fc02.zip |
From Lua 5.2: Add luaL_setmetatable().
Contributed by François Perrad.
Diffstat (limited to 'src/lj_api.c')
-rw-r--r-- | src/lj_api.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/lj_api.c b/src/lj_api.c index c784ed3f..fe8880eb 100644 --- a/src/lj_api.c +++ b/src/lj_api.c | |||
@@ -1000,6 +1000,12 @@ LUA_API int lua_setmetatable(lua_State *L, int idx) | |||
1000 | return 1; | 1000 | return 1; |
1001 | } | 1001 | } |
1002 | 1002 | ||
1003 | LUALIB_API void luaL_setmetatable(lua_State *L, const char *tname) | ||
1004 | { | ||
1005 | lua_getfield(L, LUA_REGISTRYINDEX, tname); | ||
1006 | lua_setmetatable(L, -2); | ||
1007 | } | ||
1008 | |||
1003 | LUA_API int lua_setfenv(lua_State *L, int idx) | 1009 | LUA_API int lua_setfenv(lua_State *L, int idx) |
1004 | { | 1010 | { |
1005 | cTValue *o = index2adr(L, idx); | 1011 | cTValue *o = index2adr(L, idx); |