Byte arrays possible method input
Mathilde411 opened this issue ยท 2 comments
Hello ! Would it be possible to allow byte[] as an input for a lua string in a peripheral function.
Like for example:
@LuaFunction
public final byte[] encodeAES128(byte[] data, byte[] key, byte[] iv) throws LuaException {
...
}
Directly converting the LuaString to a byte array without the possible imprecisions with working with string and encodings.
I hope it is possible, thanks ^^
I think you can use ByteBuffer
instead of byte[]
and it should all just work. Or alternatively use IArguments.getBytes
.
Basically we want to expose a ByteBuffer instead of a raw array, as it works better with the implementation of strings within the Lua runtime.