[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: checking userdata type from lua
- From: "Daniel Collins" <daniel.collins@...>
- Date: Thu, 18 May 2006 22:18:52 +0930
> You can do what luaL_checkudata does: check if the
> object's metatable is equal to the metatable of the "type".
Yes, but the metatable for the type is stored in the registry and I
thought that was only accessible from the C API.
So in lua I can get the metatable for the object I want to test with
getmetatable, but I cant see a way to get the metatable for the type
from the registry in order to do the comparison.
I guess it is not a major issue since I can implement something based on
luaL_checkudata pretty simply. I just didn't want to fall into the habit
of writing C API functions for things that can actually be done in lua
itself.
- DC