[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: First experiences with luaffi
- From: Dirk Laurie <dpl@...>
- Date: Sat, 23 Jul 2011 17:39:49 +0200
I built 2c95dcb23c31705497c5e277558c3a43cd4f7cce after adding the line
{NULL, NULL}
as pointed out by Tom Harris. Next, I made files sleep.lua, compress.lua
and metamethods.lua from the three example panels in the LuaJIT
documentation, and tried them, with the following result:
$ luajit luajit-ffi/sleep.lua
................................................................................................................................................................
$ lua5.1 luajit-ffi/sleep.lua
................................................................................................................................................................
OK.
$ luajit luajit-ffi/compress.lua
Uncompressed size: 4000
Compressed size: 32
$ lua5.1 luajit-ffi/compress.lua
Uncompressed size: 4000
lua5.1: unable to convert argument 2 from lua type number to ctype unsigned int[1]
stack traceback:
[C]: in function 'new'
luajit-ffi/compress.lua:14: in function 'compress'
luajit-ffi/compress.lua:31: in main chunk
[C]: ?
This seems to be Issue #2: "Casting is different from luajit."
But I can't figure out what to do.
$ luajit luajit-ffi/metamethods.lua
3 4
5
25
12.5
$ lua5.1 luajit-ffi/metamethods.lua
lua5.1: luajit-ffi/metamethods.lua:14: attempt to call field 'metatype' (a nil value)
stack traceback:
luajit-ffi/metamethods.lua:14: in main chunk
[C]: ?
This seems to be Todo #6.
Belatedly, I tried
$ make test
lua5.1 test.lua
lua5.1: test.lua:5: could not load library test_cdecl
stack traceback:
[C]: in function 'load'
test.lua:5: in main chunk
[C]: ?
make: *** [test] Error 1
Dirk
Dirk