mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Update Set.lua
Improve GetLast and GetRandom
This commit is contained in:
parent
047a108689
commit
2c75ea1a18
@ -387,8 +387,8 @@ do -- SET_BASE
|
||||
-- @param #SET_BASE self
|
||||
-- @return Core.Base#BASE
|
||||
function SET_BASE:GetLast()
|
||||
|
||||
local ObjectName = self.Index[#self.Index]
|
||||
local tablemax = table.maxn(self.Index)
|
||||
local ObjectName = self.Index[tablemax]
|
||||
local LastObject = self.Set[ObjectName]
|
||||
self:T3( { LastObject } )
|
||||
return LastObject
|
||||
@ -398,8 +398,8 @@ do -- SET_BASE
|
||||
-- @param #SET_BASE self
|
||||
-- @return Core.Base#BASE
|
||||
function SET_BASE:GetRandom()
|
||||
|
||||
local RandomItem = self.Set[self.Index[math.random( #self.Index )]]
|
||||
local tablemax = table.maxn(self.Index)
|
||||
local RandomItem = self.Set[self.Index[math.random(1,tablemax)]]
|
||||
self:T3( { RandomItem } )
|
||||
return RandomItem
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user