-
-
Notifications
You must be signed in to change notification settings - Fork 302
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Round-trip C# byte[]
as Lua string
#508
Comments
Can you write a test case?. I can't understand the error with this amount of information. |
I cannot modify the extant Lua scripts, so using Here's the script I'm working with: if ReadInt(continue+0xC) ~= prevContinue and ReadByte(0x711438-offset2) == 0 and blacklisted == false then
local f = io.open("KH2autosave.dat", "wb")
f:write(ReadString(continue, 0x10FC0))
f:close()
ConsolePrint("Wrote autosave")
end I am expected to implement
I can't write a test case for this unless the behavior of returning a Here's the other side of the code, which can actually accept a local f = io.open("KH2autosave.dat", "rb")
if f ~= nil then
WriteString(save1, f:read("*a"))
f:close()
ConsolePrint("Loaded autosave")
end |
I'm working with a Lua script that requires binary data be written/read in string form (the
io
functions are operating on binary files). I cannot change this as I'm required to be backwards compatible with existing scripts. How do I register a function on the NLua context such that abyte[]
is returned as a Lua string and not aSystem.Byte[]
?This data is not valid UTF-8 and as such will not survive a
raw → UTF16 → UTF8
roundtrip.The text was updated successfully, but these errors were encountered: