Skip to content

Lua Environment

The Polytoria Executor provides an extended Lua environment based on MoonSharp, deeply integrated into the game's script runtime. This section explores the capabilities of the custom Lua layer, its security model, and how it interacts with the Unity engine.


Overview

The executor doesn't just run Lua; it enhances the existing game environment. By hooking into the ScriptService, we inject powerful custom functions that are not natively available to game scripts.

How It Works

  1. Script Interception: The executor hooks ScriptService.ExecuteScriptInstance.
  2. Security Check: The Whitelist System verifies the script pointer.
  3. Environment Injection: Custom functions are registered via InstallEnvironnement().
  4. Standard Lua Support: Standard Lua 5.2 / MoonSharp functions are preserved.

Environment Modules

The custom Lua environment is organized into several key modules.

Navigating the Modules

Click on any module title below to view the detailed function reference for that category.

Module Description Key Functions
Core Core execution and identification loadstring, identifyexecutor
Tooling Game tool interaction equiptool, activatetool
Interaction Social and world interaction sendchat
Input Direct hardware simulation mouse_move, mouse_click
Drawing Real-time overlay graphics draw_line, draw_text
Networking Game protocol interaction fireclickdetector
HTTP External web communication httpget

MoonSharp Integration

We use MoonSharp as our primary Lua engine. This choice provides several advantages:

  • Seamless C++ Bridge: Fast communication between Lua and the executor's C++ core.
  • Safe Execution: Sandboxed environment for script execution.
  • Robust Coroutines: Support for complex asynchronous scripts without blocking the game.
  • Dynamic Typing: Flexible handling of Unity game objects as user data.

Learning Path

Are you ready to start scripting? Follow our guided path: