¶
luxe
API (2025.1.2
)¶
luxe: system/values.modifier
module¶
Data¶
import "luxe: system/values.modifier" for Data
no docs found
var values : List = []
Value¶
import "luxe: system/values.modifier" for Value
no docs found
var kind : ValuesKind = ValuesKind.number
var name : String = "value"
var number : Num = 0
var string : String = ""
var boolean : Bool = false
var float2 : Float2 = [0, 0]
var float3 : Float3 = [0, 0, 0]
var float4 : Float4 = [0, 0, 0, 0]
var color : Color = [1, 1, 1, 1]
Values¶
import "luxe: system/values.modifier" for Values
Values is a modifier that lets you store Key -> Value pairs. Store values like numbers, strings, and colors on an entity, which can then be accessed by name (a Key).
//we can use an enum for keys class Keys { static watered { "watered" } static apples { "apples" } } var tree = Entity.create(world) Values.create(tree) Values.set(tree, Keys.watered, true) Values.set(tree, Keys.apples, 10) Values.set(tree, "keys are strings", true) var watered = Values.get(tree, Keys.watered, false) var apples = Values.get(tree, Keys.apples, -1) Log.print("The tree is %(watered ? "watered" : "thirsty") and has %(apples) apples!")
- create(entity:
Entity
) - destroy(entity:
Entity
) - has(entity:
Entity
) - has_key(entity:
Entity
, key:String
) - remove_key(entity:
Entity
, key:String
) - get_keys(entity:
Entity
) - get(entity:
Entity
, key:String
, default:Any
) - set(entity:
Entity
, key:String
, value:Any
)
Entity
)
¶None
Attach a
Values
modifier toentity
.var entity = Entity.create(world) Values.create(entity)
Entity
)
¶None
Detach and destroy the
Values
attached toentity
Values.destroy(entity)
Entity
)
¶Bool
Returns true if
entity
has aValues
modifier attached.if(Values.has(entity)) { Log.print("Has a Values modifier!") }
Entity
, key: String
)
¶Bool
Returns true the entity's Values modifier has a value with the given 'key'
if(Values.has_key(entity, "apples")) { Log.print("The tree has some apples!") }
Entity
, key: String
)
¶None
Removes a value by key from 'entity's Values modifier, if it exists
Values.remove_key(tree, "apples")
Entity
)
¶List
Get a List of all the String keys for values on 'entity's Values modifier
var keys = Values.get_keys(grass) for (key in keys) { Log.print("Has Value Key: %(key)") }
Entity
, key: String
, default: Any
)
¶Any
Get the current value stored with
key
on the Values modifier onentity
, with a default value which is returned if the key isn't found.var seeds = Values.get(watermelon, "seeds", 0) Log.print("The watermelon has %(seeds) seeds!")
Entity
, key: String
, value: Any
)
¶None
Set the value stored at the 'key' on the Values modifier on 'entity'.
if(Values.has(seed)) { Values.set(seed, "planted", true) }
ValuesKind¶
import "luxe: system/values.modifier" for ValuesKind
no docs found
unknown
no docs found
unknown
no docs found
unknown
no docs found
unknown
no docs found
unknown
no docs found
unknown
no docs found
unknown
no docs found
ValuesType¶
import "luxe: system/values.modifier" for ValuesType
no docs found
unknown
no docs found
unknown
no docs found
unknown
no docs found
unknown
no docs found
unknown
no docs found
unknown
no docs found
unknown
no docs found
Any
)
¶unknown
no docs found