For Each Unit in Group

From LuaSTG Wiki
Jump to navigation Jump to search

A for each unit in group node will run its code for every unit that is included in a particular group. In other words, for each unit in group is a loop that iterates through every object in a group.


Groups in LuaSTG[edit | edit source]

Objects in LuaSTG are divided into groups based on their group attribute. When objects are created, they are usually assigned to a group automatically by the engine. See the Object Group section of List of LuaSTG Constant Variables and Values for a list of available groups.


Example of Use[edit | edit source]

Below is an example of using for each unit in group node to remove all enemies from the game before a boss fight starts.

Example of for each to implement- Delete enemies before a boss.png