Rachhet Posted January 30, 2017 Share 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> Link to comment
enzopaul4 Posted January 30, 2017 Share Posted January 30, 2017 addCommandHandler ("s", function (thePlayer) outputChatBox("".. getPlayerName(player) ..":Siema!") end ) Do you mean something like this? Link to comment
Rachhet Posted January 30, 2017 Author Share 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? .. Link to comment
enzopaul4 Posted January 30, 2017 Share 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 Link to comment
LoPollo Posted January 30, 2017 Share 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 Link to comment
Rachhet Posted January 30, 2017 Author Share 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. Link to comment
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