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/web_playerlist.lua | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) (limited to 'Plugins/Core/web_playerlist.lua') diff --git a/Plugins/Core/web_playerlist.lua b/Plugins/Core/web_playerlist.lua index 62ccb1d44..ed6b7667c 100644 --- a/Plugins/Core/web_playerlist.lua +++ b/Plugins/Core/web_playerlist.lua @@ -1,6 +1,3 @@ -local PlayerHTML = "" -local PlayerNum = 0 - function HandleRequest_PlayerList( Request ) local World = cRoot:Get():GetWorld() local Content = "" @@ -19,25 +16,21 @@ function HandleRequest_PlayerList( Request ) Content = Content .. "

Connected Players: " .. World:GetNumPlayers() .. "

" Content = Content .. "" - PlayerNum = 0 - PlayerHTML = "" - World:ForEachPlayer( CreatePlayerList ) + local PlayerNum = 0 + local AddPlayerToTable = function( Player ) + PlayerNum = PlayerNum + 1 + Content = Content .. "" + Content = Content .. "" + Content = Content .. "" + Content = Content .. "" + Content = Content .. "" + end + World:ForEachPlayer( AddPlayerToTable ) - if( PlayerHTML ~= "" ) then - Content = Content .. PlayerHTML - else + if( PlayerNum == 0 ) then Content = Content .. "" end Content = Content .. "
" .. PlayerNum .. "." .. Player:GetName() .. "Kick
None
" Content = Content .. "
" return Content -end - -function CreatePlayerList( Player, Data ) - PlayerNum = PlayerNum + 1 - PlayerHTML = PlayerHTML .. "" - PlayerHTML = PlayerHTML .. "" .. PlayerNum .. "." - PlayerHTML = PlayerHTML .. "" .. Player:GetName() .. "" - PlayerHTML = PlayerHTML .. "Kick" - PlayerHTML = PlayerHTML .. "" end \ No newline at end of file -- cgit v1.2.3