Skip to content

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)

Values.create(entity: Entity) returns None

Attach a Values modifier to entity.

var entity = Entity.create(world)
Values.create(entity)

Values.destroy(entity: Entity) returns None

Detach and destroy the Values attached to entity

Values.destroy(entity)

Values.has(entity: Entity) returns Bool

Returns true if entity has a Values modifier attached.

if(Values.has(entity)) {
  Log.print("Has a Values modifier!")
}

Values.has_key(entity: Entity, key: String) returns 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!")
}

Values.remove_key(entity: Entity, key: String) returns None

Removes a value by key from 'entity's Values modifier, if it exists

Values.remove_key(tree, "apples")

Values.get_keys(entity: Entity) returns 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)")
}

Values.get(entity: Entity, key: String, default: Any) returns Any

Get the current value stored with key on the Values modifier on entity, 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!")

Values.set(entity: Entity, key: String, value: Any) returns 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


ValuesKind.number returns unknown

no docs found

ValuesKind.string returns unknown

no docs found

ValuesKind.boolean returns unknown

no docs found

ValuesKind.float2 returns unknown

no docs found

ValuesKind.float3 returns unknown

no docs found

ValuesKind.float4 returns unknown

no docs found

ValuesKind.color returns unknown

no docs found

ValuesType

import "luxe: system/values.modifier" for ValuesType

no docs found


ValuesType.unknown returns unknown

no docs found

ValuesType.bool returns unknown

no docs found

ValuesType.number returns unknown

no docs found

ValuesType.string returns unknown

no docs found

ValuesType.float2 returns unknown

no docs found

ValuesType.float3 returns unknown

no docs found

ValuesType.float4 returns unknown

no docs found

ValuesType.name(value: Any) returns unknown

no docs found