Re: Possible to store a reference to a lua table in an ffi struct?

  • From: demetri <demetri.spanos@xxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Fri, 21 Mar 2014 23:16:08 -0700

One bit of elaboration: if you care you can make a C struct tableref {int
uid;} and attach a metatype to it to give you some syntactic convenience:
mystruct.member_tableref.foo will look up "foo" through the __index method
of the tableref's metatype (i.e. looking up the table through uid2tbl and
then getting tbl["foo"]).

Demetri

Other related posts: