Re: FFI enums are now always boxed

  • From: Daurnimator <quae@xxxxxxxxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Fri, 20 Jul 2012 14:58:35 +1000

On 18 July 2012 07:08, Mike Pall <mike-1207@xxxxxxxxxx> wrote:
> This change may break compatibility with existing programs using
> the FFI, if you pass an enum to a non-FFI function. Hopefully this
> is not very common. You may need to explicitly convert the enum to
> a plain Lua number with tonumber(). Or better declare the field or
> return value as an integer, if it's usually treated like a number.

Thought I should note here that I hit an issue with this:
You can't use a boxed enum as a table index.

I had a callback that received an enum; and it was indexing a table to
dispatch to correct function.
(Now I just wrapped it in tonumber)

Other related posts: