forked from mtcontrib/random_messages
fix
This commit is contained in:
parent
597bfa0e5a
commit
002f32c6ae
8
init.lua
8
init.lua
@ -11,8 +11,14 @@ math.randomseed(os.time())
|
||||
random_messages = {}
|
||||
random_messages.messages = {} --This table contains all messages.
|
||||
|
||||
function table.count( t )
|
||||
local i = 0
|
||||
for k in pairs( t ) do i = i + 1 end
|
||||
return i
|
||||
end
|
||||
|
||||
function table.random( t )
|
||||
local rk = math.random( 1, table.Count( t ) )
|
||||
local rk = math.random( 1, table.count( t ) )
|
||||
local i = 1
|
||||
for k, v in pairs( t ) do
|
||||
if ( i == rk ) then return v, k end
|
||||
|
Loading…
Reference in New Issue
Block a user