Aqua22 Posted June 4, 2019 Share Posted June 4, 2019 Hi! I wanted to create a broadcast script and i've got this error: attempt to concatenate local 'msg' (a userdata value) server.lua : function ad (msg) outputChatBox ( "#fbe0ff[Hiradó]: " .. msg .. getRootElement(), 255, 255, 255, true ) end addCommandHandler ("hirado", ad) and i don't know what the problem is. Sorry the link for scripting subforum is doesn't works for me. Link to comment
0 keymetaphore Posted June 5, 2019 Share Posted June 5, 2019 That's an easy fix. You don't have to concatenate the end of the string if it's not followed by anything. function ad (msg) outputChatBox ( "#fbe0ff[Hiradó]: " .. msg, getRootElement(), 255, 255, 255, true ) end addCommandHandler ("hirado", ad) This will work. If you want to continue the string after msg, here's how it would look: function ad (msg) outputChatBox ( "#fbe0ff[Hiradó]: " .. msg .. " and yeah", getRootElement(), 255, 255, 255, true ) end addCommandHandler ("hirado", ad) Link to comment
0 Aqua22 Posted June 5, 2019 Author Share Posted June 5, 2019 28 minutes ago, keymetaphore said: That's an easy fix. You don't have to concatenate the end of the string if it's not followed by anything. function ad (msg) outputChatBox ( "#fbe0ff[Hiradó]: " .. msg, getRootElement(), 255, 255, 255, true ) end addCommandHandler ("hirado", ad) This will work. If you want to continue the string after msg, here's how it would look: function ad (msg) outputChatBox ( "#fbe0ff[Hiradó]: " .. msg .. " and yeah", getRootElement(), 255, 255, 255, true ) end addCommandHandler ("hirado", ad) Thansk very much! 1 Link to comment
Question
Aqua22
Hi! I wanted to create a broadcast script and i've got this error:
attempt to concatenate local 'msg' (a userdata value)
server.lua :
function ad (msg)
outputChatBox ( "#fbe0ff[Hiradó]: " .. msg .. getRootElement(), 255, 255, 255, true )
end
addCommandHandler ("hirado", ad)
and i don't know what the problem is.
Sorry the link for scripting subforum is doesn't works for me.
Link to comment
2 answers to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now