Output of tostring that should be the same are not equal if done outside of "events"
function test()
if tostring(5) == tostring(5) then
ll.Say(0,"EQUAL")
else
ll.Say(0,"NOT EQUAL")
end
end
test()
touch_start = test
Says
NOT EQUAL
in chat on start, but
EQUAL
on touch
Running luau locally this
print(`{tostring(5) == tostring(5)}`)
prints
true
String comparison in general works
local last_msg = ""
listen = function(chan, name, id, msg)
if msg == last_msg then
ll.Say(0, "Stop Repeating Yourself")
end
last_msg = msg
end
ll.Listen(0,"","","")
Says
Stop Repeating Yourself
in local if you say the same thing twice
A more comprehensive script that started this adventure, note that it works fine in the touch event
function test()
ll.Say(0,"============================")
local own1 = ll.GetOwner()
local own2 = ll.GetOwner()
local comp = own1 == own2
if comp then
ll.Say(0, `UUID EQUAL: {comp}`)
else
ll.Say(0, `UUID NOT EQUAL: {comp}`)
end
if own1 == own2 then
ll.Say(0, `UUID EQUAL`)
else
ll.Say(0, `UUID NOT EQUAL`)
end
ll.Say(0, tostring(own1))
ll.Say(0, tostring(own2))
own1 = tostring(own1)
own2 = tostring(own2)
comp = own1 == own2
if comp then
ll.Say(0, `STRING EQUAL: {comp}`)
else
ll.Say(0, `STRING NOT EQUAL: {comp}`)
end
if own1 == own2 then
ll.Say(0, `STRING EQUAL`)
else
ll.Say(0, `STRING NOT EQUAL`)
end
ll.Say(0, own1)
ll.Say(0, own2)
ll.Say(0,"============================")
end
test()
ll.Sleep(2.0)
test()
touch_start = test