On 3/22/14, 2:16 AM, demetri wrote:
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"]).Using that same technique, you can store just the vector<string>-replacement table in the metatable. The downside of this approach is that you will need a different metatype/metatable for each instance (unless the intention is to share this vector<string> among among instances, i.e. a C++ static class member).Demetri
For example: t = ffi.metatype( "struct { int a, b, c; }", { __index = { vstr = {} } }) foo = t() foo.vstr[#foo.vstr+1] = "string1" -Evan