mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-30 20:41:41 +09:00
Add StdLib and Rank Table
This commit is contained in:
26
locale/StdLib/game.lua
Normal file
26
locale/StdLib/game.lua
Normal file
@@ -0,0 +1,26 @@
|
||||
--- Game module
|
||||
-- @module Game
|
||||
-- @usage local Game = require('stdlib/game')
|
||||
|
||||
Game = {} --luacheck: allow defined top
|
||||
|
||||
Game.VALID_FILTER = function(v)
|
||||
return v.valid
|
||||
end
|
||||
|
||||
--- Messages all players currently connected to the game
|
||||
-- @tparam string msg message to send to players
|
||||
-- @param[opt] condition condition to be true for the player to be messaged
|
||||
-- @treturn int the number of players who received the message. Offline players are not counted as having received the message.
|
||||
function Game.print_all(msg, condition)
|
||||
local num = 0
|
||||
for _, player in pairs(game.connected_players) do
|
||||
if condition == nil or select(2, pcall(condition, player)) then
|
||||
player.print(msg)
|
||||
num = num + 1
|
||||
end
|
||||
end
|
||||
return num
|
||||
end
|
||||
|
||||
return Game
|
||||
Reference in New Issue
Block a user