Skip to main content

Poppable

Based on game build 714014 | Last updated: 2026-03-03

Overview

Poppable is a lightweight component that enables an entity to be marked as "popped" exactly once. It supports an optional callback (onpopfn) that executes upon the first call to Pop(). The component is stateful and ignores subsequent Pop() calls after the first. It is typically used for one-time initialization or destruction events, such as removing visual effects, triggering animations, or cleaning up resources.

Usage example

local inst = CreateEntity()
inst:AddComponent("poppable")
inst.components.poppable.onpopfn = function(inst)
print("Entity was popped!")
inst:Remove()
end
inst.components.poppable:Pop()

Dependencies & tags

Components used: None identified
Tags: None identified

Properties

PropertyTypeDefault ValueDescription
poppedbooleanfalseWhether the entity has been popped. Read-only for external access.
onpopfnfunction?nilOptional callback function invoked once when Pop() is first called. Receives self.inst as its sole argument.

Main functions

Pop()

  • Description: Marks the entity as popped and invokes onpopfn once, if set. Subsequent calls have no effect.
  • Parameters: None.
  • Returns: Nothing.

Events & listeners

None identified