| 997 | } |
| 998 | |
| 999 | bool IsValidInstance(lua_State* L) { |
| 1000 | int top = lua_gettop(L); |
| 1001 | (void)top; |
| 1002 | GetInstance(L); |
| 1003 | if (GetMetaFunction(L, -1, META_TABLE_IS_VALID, sizeof(META_TABLE_IS_VALID) - 1)) { |
| 1004 | lua_pushvalue(L, -2); |
| 1005 | lua_call(L, 1, 1); |
| 1006 | assert(top + 2 == lua_gettop(L)); |
| 1007 | bool result = lua_toboolean(L, -1); |
| 1008 | lua_pop(L, 2); |
| 1009 | assert(top == lua_gettop(L)); |
| 1010 | return result; |
| 1011 | } |
| 1012 | lua_pop(L, 1); |
| 1013 | assert(top == lua_gettop(L)); |
| 1014 | return false; |
| 1015 | } |
| 1016 | |
| 1017 | void SetContextValue(HContext context) |
| 1018 | { |
no test coverage detected