Skip to content

Object Manager

Provides access to game objects. Always validate objects with is_valid() before use.

Always Validate Objects

Objects can become invalid at any time. Use guard clauses to prevent errors.

lua
function on_tick()
    local player = core.object_manager.get_local_player()
    if not player or not player:is_valid() then
        return
    end

    -- Safe to use player here
end

Functions

core.object_manager.get_local_player() -> Player | nil

Returns the local player object or nil if unavailable.


core.object_manager.get_current_map() -> Map | nil

Returns the current map object or nil if unavailable.