Skip to content

API Reference ​

This section provides documentation for the ScheduleLua API functions and modules.

Beta Development Notice: ScheduleLua is currently in beta development. APIs may change, and some features described here are not yet fully implemented.

Implementation Status ​

The ScheduleLua API is being actively developed. Here's the current implementation status of major API categories:

API CategoryStatus
Core API✅ Stable
Player API🔄 Partial
World API🔄 Partial
NPC API🔄 Partial
Helper Functions🔄 Partial
Windows API🔄 Partial
UI API🔄 Partial
Registry API🔄 Partial
Economy API🔄 Partial
Law API🔄 Partial

See the Development Status page for more detailed information.

API Categories ​

Core API - ✅ Stable ​

Core functionality including logging, commands, timing, general game object manipulation, and global variables.

Player API - 🔄 Partial ​

Functions for interacting with the player character, including movement, inventory, stats, and state.

NPC API - 🔄 Partial ​

Tools for finding, managing, and interacting with NPCs in the game world.

World API - 🔄 Partial ​

Functions for interacting with the game world, including time, map regions, and explosions.

Helper Functions - 🔄 Partial ​

Utility functions such as Vector3 operations to simplify common tasks.

Unity API - 🔄 Partial ​

Functions for Unity-specific features like key input detection.

UI API - 🔄 Experimental ​

Create notifications and basic UI elements. Advanced features are still in development.

Registry API - 🔄 Experimental ​

Store and retrieve data persistent across script executions and game sessions.

Economy API - 🔄 Partial ​

Interact with the game's economy system, including player money and transactions.

Law API - 🔄 Partial ​

Interact with the game's law system, including curfew management.

Function Naming Conventions ​

ScheduleLua follows consistent naming conventions to make the API intuitive:

  • Get* - Functions that retrieve data (e.g., GetPlayerPosition, GetGameTime)
  • Set* - Functions that modify data (e.g., SetPlayerHealth, SetNPCPosition)
  • Find* - Functions that search for specific entities (e.g., FindNPC, FindGameObject)
  • Is* - Functions that return boolean values (e.g., IsNightTime, IsNPCInRegion)
  • Register* - Functions that register callbacks or commands (e.g., RegisterCommand)
  • Unregister* - Functions that remove registered callbacks or commands (e.g., UnregisterCommand)
  • On* - Callback functions triggered by specific events (e.g., OnPlayerReady, OnDayChanged)

Function Documentation Format ​

Each function in the API is documented with the following information:

  • Signature: The function's parameter types and return value
  • Implementation Status: Current development status (stable, experimental, planned)
  • Description: What the function does
  • Parameters: Details about each parameter
  • Returns: Description of what the function returns
  • Examples: Code examples showing how to use the function
  • Notes: Additional information, limitations, and best practices

Script Lifecycle Hooks ​

Your Lua scripts can implement several lifecycle hooks that are called at specific points during execution:

HookStatusDescription
Initialize()✅ StableCalled when the script is first loaded
Update()✅ StableCalled every frame
OnConsoleReady()✅ StableCalled when the console is loaded and ready
OnPlayerReady()✅ StableCalled when the player is loaded and ready
OnSceneLoaded(sceneName)✅ StableCalled when a new scene is loaded
OnDayChanged(day)🔄 PartialCalled when the game day changes
OnTimeChanged(time)🔄 PartialCalled when the game time changes
OnPlayerHealthChanged(newHealth)🔄 PartialCalled when player health changes
OnPlayerEnergyChanged(newEnergy)🔄 PartialCalled when player energy changes
Shutdown()✅ StableCalled when the script is unloaded

Contributing to the API ​

ScheduleLua is an open-source project in active development. If you'd like to contribute:

For detailed information about each function and module, explore the sidebar navigation.

Released as Beta Software under the GPL-3.0 License.