[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: SWIG C structures
- From: Miles Bader <miles@...>
- Date: Fri, 21 Jan 2011 09:57:00 +0900
Dwight Schauer <dschauer@gmail.com> writes:
> With SWIG C structures are treated as userdata in Lua. Is there any
> automatic way to convert one of these to a Lua table that can more
> easily be marshalled? Or do I have to make a struct to table copy
> function (and back) on a per structure definition basis?
That's really a Swig issue, not a Lua one.
I suspect it's possible -- much of Swig's Lua-C interface is
table-driven, particularly data access and type-checking.
I'd look at the C code generated by Swig (it's fairly repetitive, and
not hard to understand). E.g., look at how it implements the __index
metatable operation for Swig userdata.
-Miles
--
Learning, n. The kind of ignorance distinguishing the studious.