how can I use c-struct in lua?
+2
A:
A terse question on a vast topic...
You can use, for example, the http://www.inf.puc-rio.br/~roberto/struct/ library, made by one of the Lua authors. There are alternatives, including writing your own C code to interface with Lua, access or build the structure, etc.
PhiLho
2009-08-05 10:45:09
+3
A:
If you need to access fields in a C struct from Lua, set a userdata to the address of the C struct and set suitable metamethods to get and set fields.
lhf
2009-08-05 23:14:17