print(), LL say functions and linked messages don't work with strings containing ascii 0
expected
SuzannaLinn Resident
printing:
print("test\0ing", "something") -- > test something
ll.OwnerSay("test\0ing") -- > test
saying on a channel to another object:
-- object 1
local s = "test\0ing"
LLEvents:on("touch_start", function()
ll.RegionSay(1, s)
end)
-- object 2
LLEvents:on("listen", function(_, _, _, msg)
print(#msg, msg)
end)
ll.Listen(1, "", "", "")
-- > 4 test
linked messaging:
-- script1
local s = "test\0ing"
LLEvents:on("touch_start", function()
ll.MessageLinked(LINK_THIS, 0, s, s)
end)
-- script 2
LLEvents:on("link_message", function(_, _, s1, s2)
print(#s1, s1, #s2, s2)
end)
-- > 4 test 4 test
Log In
H
Harold Linden
marked this post as
expected
This is expected, all
ll
APIs behave badly with embedded NUL bytes, and that incldue the ll.OwnerSay()
underlying print()
. It's not an ideal situation, but if you ever need to transit those, they need to be encoded.