[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: [LuaJIT] C-API Question on meta table for C closure
- From: Jonathan Castello <twisolar@...>
- Date: Fri, 3 Sep 2010 01:01:34 -0700
On Fri, Sep 3, 2010 at 12:49 AM, Stefan Behnel <email@example.com> wrote:
> Is that the expected behaviour? Is there a way to define a metatable only
> for a specific C function?
Only tables and full-userdata can have their own individual
metatables. For other types, one metatable is shared amongst all
instances of a given type. You could think of this as because tables
and userdata let you define your own types, each with its own
metatable. It doesn't make sense to assign a metatable to just the
integer 42, and not any others. Likewise, functions always behave the
same: you call them and they do stuff.
Maybe you could set the __ call metamethod on your userdatum's metatable?