Rachhet Posted January 30, 2017 Posted January 30, 2017 addCommandHandler ("s", function(player) getPlayerName(player) outputChatBox(getPlayerName(player)player":Siema!") end ) I want this script to output a chat message after showing who player is typing. <player>:"Siema!" not Siema! <player>
enzopaul4 Posted January 30, 2017 Posted January 30, 2017 addCommandHandler ("s", function (thePlayer) outputChatBox("".. getPlayerName(player) ..":Siema!") end ) Do you mean something like this?
Rachhet Posted January 30, 2017 Author Posted January 30, 2017 1 minute ago, enzopaul4 said: addCommandHandler ("s", function (thePlayer) outputChatBox("".. getPlayerName(player) ..":Siema!") end ) Do you mean something like this? Yes, but i just dont understand the.. dots! Nothing was describing them on tutorials. Can you tell me what these dots are doing? ..
enzopaul4 Posted January 30, 2017 Posted January 30, 2017 If you want to put a function in another function , (i am not sure) you put the dots to connect the both functions. addCommandHandler ("s", function (thePlayer) outputChatBox("".. getPlayerName(thePlayer) ..":Siema!") end ) Try this , i think that's the right form
LoPollo Posted January 30, 2017 Posted January 30, 2017 The double dots? It's not exactly to "connect" functions, they are string concatenation operators. getPlayerName returns a string (the name of the player, ex "Foo"), and you concatenate then with ":siema!": "Foo"..":Siema!" = "Foo:Siema!" https://www.lua.org/pil/3.4.html
Rachhet Posted January 30, 2017 Author Posted January 30, 2017 I'm just happy that people respond on this forum. Because of you guys, i'm getting better at this. Thanks for responds, it means a lot for me.
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