Lua API Reference

From Bonfire by Hogswild Prasetto
Revision as of 23:05, 11 April 2020 by bonfire-wiki>Sonic260 (Created the Lua API Page. This is still a work in progress.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This page contains documentation for all the known functions within the Lua Bonfire API. For more information for running Lua code in Bonfire, please see the Lua scripting page.

Lua Console Commands

This table comprises the list of Lua-related console commands to actually inject, run, or even delete scripts from the console target's inventory. These can be placed into a scroll, macro, or NPC's CustomCall action during dialogue.

Command

Usage

Effect

oluainj

oluainj luaScriptName

Injects a Lua script into the target's inventory.

Scripts must be saved in the below directory first: %appdata%/Prasetto/Bonfire/Mods/lua

oluacf

oluacf luaScriptName,functionName

Executes a single Lua function functionName within the injected script once.

oluaiifr

oluaiifr

luaScriptName,functionName,duration

Causes a single Lua function to iterate, and execute repeatedly for a set duration. When the iteration will stop when the duration is exceeded.

Tip: Set duration to "Infinity" to make the script run forever.

oluaria

oluaria luaScriptName,functionName

oluaria

Stops a function within a Lua script from iterating. Using oluaria with no parameters stop all iterating scripts.

oluarem

oluarem luaScriptName

Removes the Lua script from your inventory. This will also stop any related iterators.

Automatic Functions / Code

This code will execute automatically when injected into the target's inventory using the oluainj command. This removes the need to run functions manually with oluacf or oluaiifr. Note: The start() and update() functions will not run automatically if injected as an OrcLuaScript action with macros.

Function Name

Return Type

Description /Usage

start

void

The start() function will execute once upon injection.

update

void

The update() function will start an iterator that runs for Infinity seconds upon injection.

[chunk space]

N/A

“Chunk Space” refers to any code lying outside of a function within a Lua file. This code will execute once upon injection AND whenever the holder enters a new scene.

This is typically used for setting variables and preemptively granting data flags.

Orc Properties

Targeting

Positioning

Physical Attributes

Flags / Booleans

Misc Properties

Orc Functions

Targeting

Sex

Data Flags

Sounds

Misc Functions

Orc.Game Properties

Orc.Game Functions

Asset Properties

Asset Functions