Powder Toy Lua API
The Powder Toy Lua API is a set of objects and functions that was introduced in version 83 (The TPT++ Release). They allow control over some aspects of the game, including graphics, element interactions, and interfaces.
boxmein made a massive reference to most parts of the API, including some that are not added to this wiki yet. You can find it here.
The API is split into several categories
- Includes UI components such as buttons, labels and checkboxes, access to the very primitive window manager and input events
- Methods and constants for interacting with the display mode
- Methods and constants for modifying and creating elements
- Methods for modifying the state of the simulation
- Methods for drawing simple shapes and text on screen.
- File System
- Functions for creating, deleting, modifying and enumerating files and folders.
- Functions for doing OS-level things like opening URLs or interacting with the clipboard.
- Listen for events, such as mouseclicks or key presses.
- Built-in LuaSocket library available as the
- Provides access to basic HTTP functionality in the form of request objects.
- Doesn't actually provide any interaction with the game, but provides some functions for performing bitwise operations on integer numbers.
- Old Lua API with the tpt.* prefix