Class: object
Lua
C++
Edit

object:SetField

This method sets a field on the object in the Lua virtual machine.


Syntax

object:SetField(name, value)

Parameters


Example

-- Create an object
local box = CreateBox(nil)

-- Set a field
box:SetField("health", 100)

-- Retrieve the value
local o = box:GetField("health")
if type(o) == "number" then
    print(o)
end

Output:

100
Copyright © 2024 Ultra Software.
All rights reserved.