Drawing

cleardrawcache

Clears Real's global Drawing object list.

Syntax

cleardrawcache()

Description

Clears Real's global Drawing object list. Each tracked Drawing object is marked as destroyed, image resources are released when present, and the object list is emptied. Existing Lua references to cleared Drawing objects may still exist, but the objects are no longer considered active Drawing objects. the Drawing API registers this API only when the required rendering environment is active is true; when that check is false, the initializer returns before creating these globals.

Call it without parameters. The function reads the needed context from the current runtime state.

It does not return data. Treat the call as an action and handle errors around the call site when needed.

Example

Clear every Drawing object currently tracked by Real.

local square = Drawing.new("Square")
square.Visible = true

cleardrawcache()
print(square.Visible)