| 852 | } |
| 853 | |
| 854 | LUA_API void *xlua_tostruct(lua_State *L, int idx, int meta_ref) { |
| 855 | CSharpStruct *css = (CSharpStruct *)lua_touserdata(L, idx); |
| 856 | if (NULL != css) { |
| 857 | if (lua_getmetatable (L, idx)) { |
| 858 | lua_rawgeti(L, -1, 1); |
| 859 | if (lua_type(L, -1) == LUA_TNUMBER && (int)lua_tointeger(L, -1) == meta_ref) { |
| 860 | lua_pop(L, 2); |
| 861 | return css->data; |
| 862 | } |
| 863 | lua_pop(L, 2); |
| 864 | } |
| 865 | } |
| 866 | return NULL; |
| 867 | } |
| 868 | |
| 869 | LUA_API int xlua_gettypeid(lua_State *L, int idx) { |
| 870 | int type_id = -1; |
nothing calls this directly
no test coverage detected