From 5e1033c567064ffc4a81ac5a2f916db98e3a50ee Mon Sep 17 00:00:00 2001 From: faketruth Date: Wed, 15 Feb 2012 13:16:42 +0000 Subject: Can now pass any argument to cWorld:ForEachPlayer in Lua! But I'm not even using it.. lol git-svn-id: http://mc-server.googlecode.com/svn/trunk@262 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- Plugins/Core/playerlist.lua | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'Plugins/Core/playerlist.lua') diff --git a/Plugins/Core/playerlist.lua b/Plugins/Core/playerlist.lua index 63990e825..f06dfed85 100644 --- a/Plugins/Core/playerlist.lua +++ b/Plugins/Core/playerlist.lua @@ -1,7 +1,9 @@ -local PlayerTable = {} - function HandlePlayerListCommand( Split, Player ) - PlayerTable = {} + + local PlayerTable = {} + local AppendToTable = function( Player ) + table.insert(PlayerTable, Player:GetName() ) + end Player:GetWorld():ForEachPlayer( AppendToTable ) local Message = cChatColor.Green .. "Connected players: (".. cChatColor.White.. #PlayerTable .. cChatColor.Green .. ")" @@ -9,8 +11,4 @@ function HandlePlayerListCommand( Split, Player ) Player:SendMessage( table.concat(PlayerTable, " ") ) return true -end - -function AppendToTable( Player ) - table.insert(PlayerTable, Player:GetName() ) end \ No newline at end of file -- cgit v1.2.3