pub struct LuaRandomGenerator;Expand description
A deterministic random generator independent from the core games random generator that can be seeded and re-seeded at will. This random generator can be saved and loaded and will maintain its state.
Note this is entirely different from calling math.random() and you should be sure you actually want to use this over calling math.random(). If you aren’t sure if you need to use this over calling math.random() then you probably don’t need to use this.
Implementations§
Source§impl LuaRandomGenerator
impl LuaRandomGenerator
Sourcepub fn object_name(&self) -> &str
pub fn object_name(&self) -> &str
The class name of this object. Available even when valid is false. For LuaStruct objects it may also be suffixed with a dotted path to a member of the struct.
Sourcepub fn valid(&self) -> bool
pub fn valid(&self) -> bool
Is this object valid? This Lua object holds a reference to an object within the game engine. It is possible that the game-engine object is removed whilst a mod still holds the corresponding Lua object. If that happens, the object becomes invalid, i.e. this attribute will be false. Mods are advised to check for object validity if any change to the game state might have occurred between the creation of the Lua object and its access.
Trait Implementations§
Source§impl Clone for LuaRandomGenerator
impl Clone for LuaRandomGenerator
Source§fn clone(&self) -> LuaRandomGenerator
fn clone(&self) -> LuaRandomGenerator
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more