[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: getmetatable(cdata) return string 'ffi', why not a table
- From: Matthew Wild <mwild1@...>
- Date: Sat, 11 Jun 2011 14:01:42 +0100
On 11 June 2011 07:26, zhiguo zhao <zhaozg@gmail.com> wrote:
> cdata create with ffi.new.
> getmetatable(cdata) return string 'ffi', why not a table
> when use ffi, we need to handle getmetatable not return table.
>
That can technically happen in plain Lua already:
local a = setmetatable({}, { __metatable = "string" });
print(getmetatable(a));
Although I've never seen a string used before, boolean 'false' is
often used just to hide/protect a metatable.
Regards,
Matthew