CC: Tweaked

CC: Tweaked

57M Downloads

Byte arrays possible method input

Mathilde411 opened this issue ยท 2 comments

commented

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 ^^

commented

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.

commented

Yup, it works like a charm !
Thank you, I didn't know about this :)