[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: about luaffi
- From: Daurnimator <quae@...>
- Date: Wed, 12 Sep 2012 22:31:21 +1000
On 12 September 2012 21:31, Martin Krpan <wtxnh-lua@yahoo.com.au> wrote:
> Hello,
> I have compiled luaffi module from https://github.com/jmckaskill/luaffi
> and when I try to run example from http://luajit.org/ext_ffi_tutorial.html
> I get error on this line:
>
> local buflen = ffi.new("unsigned long[1]", n) -- this is line 14
>
> ~/tmp/progr/source/LUA/git/luaffi_my $ lua zlibtest.lua
> Uncompressed size: 4000
> lua: unable to convert argument 2 from lua<number> to cdata<unsigned int[1]>
> stack traceback:
> [C]: in function 'new'
> zlibtest.lua:14: in function 'compress'
> zlibtest.lua:31: in main chunk
> [C]: ?
>
You need to pass n in a table.
local buflen = ffi.new("unsigned long[1]", {n})