Jump to content




Chat Box Wont Say Variables


  • You cannot reply to this topic
2 replies to this topic

#1 Mike_Wazowski00

  • Members
  • 11 posts

Posted 24 August 2013 - 11:30 AM

Im writing a code for my server when someone dies to say LOL player DIED!!!! :D

mainly just to tick people off as a joke but this happens
chat:5: bad argument #2 (expected number)
i tried having it print on the computer and it works just fine, what am i doing wrong?

cb = peripheral.wrap("left")

while true do
 e,player,killer,cause = os.pullEvent("chat_death")
 cb.say("LOL ",player," DIED!!! :D/>")
end

also ignore the />/> in the print message, BB code added them

ty in advanced:)

#2 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 24 August 2013 - 11:51 AM

You're using a weird feature of the print command, which only works for print (and possibly write). You should use actual concatenation instead:

cb.say("Unfortunately, "..player.." is dead.")

Notice the two periods together. That's the concatenation operator, and it joins it all into one string.

#3 Mike_Wazowski00

  • Members
  • 11 posts

Posted 24 August 2013 - 12:27 PM

ty!





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users