Byte arrays possible method input #700
-
Hello ! Would it be possible to allow byte[] as an input for a lua string in a peripheral function. @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 ^^ |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
I think you can use 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. |
Beta Was this translation helpful? Give feedback.
-
Yup, it works like a charm ! |
Beta Was this translation helpful? Give feedback.
I think you can use
ByteBuffer
instead ofbyte[]
and it should all just work. Or alternatively useIArguments.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.