pass sharedtable match

This commit is contained in:
zixun
2019-06-15 11:26:40 +08:00
committed by 云风
parent 6803f45aa1
commit e9581adfc4
2 changed files with 17 additions and 3 deletions

View File

@@ -54,6 +54,17 @@ mark_shared(lua_State *L) {
}
}
static int
lis_sharedtable(lua_State* L) {
int b = 0;
if(lua_type(L, 1) == LUA_TTABLE) {
Table * t = (Table *)lua_topointer(L, 1);
b = isshared(t);
}
lua_pushboolean(L, b);
return 1;
}
static int
make_matrix(lua_State *L) {
// turn off gc , because marking shared will prevent gc mark.
@@ -212,6 +223,7 @@ luaopen_skynet_sharetable_core(lua_State *L) {
luaL_Reg l[] = {
{ "clone", clone_table },
{ "matrix", matrix_from_file },
{ "is_sharedtable", lis_sharedtable },
{ NULL, NULL },
};
luaL_newlib(L, l);