tags:

views:

456

answers:

2
+1  Q: 

Lua and C-struct

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
+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