LuaJIT FFI: char[?] initialization from string
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: LuaJIT FFI: char[?] initialization from string
- From: Florian Weimer <fw@...>
- Date: 2011年1月24日 13:16:31 +0100
This:
| local ffi = require "ffi"
| print(string.byte(ffi.string(ffi.new("char[3]", "ABC"), 3), 1, -1))
prints:
| 65 66 0
I think this is rather surprising. I would have expected:
| 65 66 67
Is this a bug or a feature?