jmckaskill / luaffi

Standalone FFI library for calling C functions from lua. Compatible with the luajit FFI interface.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

2 arg form of ffi.copy not supported

justincormack opened this issue · comments

This should work:

local ffi = require "ffi"

s = "test"

c = ffi.new("char[40]")

ffi.copy(c, s)

for copying Lua strings, the 2 argument form of ffi.copy, but we get


lua: tmp.lua:7: bad argument #3 to 'copy' (number expected, got table)
stack traceback:
    [C]: in function 'copy'
    tmp.lua:7: in main chunk
    [C]: ?