Re: get struct member as cdata

  • From: Cosmin Apreutesei <cosmin.apreutesei@xxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Thu, 17 May 2012 03:01:18 +0300

Btw, I know I can make an anonymous union with the signed version of
the field so this is not a showstopper in any way, I was just
curious/hoping for a "runtime" solution.

On Thu, May 17, 2012 at 2:42 AM, Cosmin Apreutesei
<cosmin.apreutesei@xxxxxxxxx> wrote:
> Hi, I have a struct with a member of type uint and I want to get it as
> a signed int, so that I can get say the value 0xffffffff as -1. The
> problem as I see it is that indexing a struct returns Lua types
> instead of cdata so it's too late for a ffi.cast(). Any way to solve
> this? Thanks.

Other related posts: