Difference between revisions of "Powder Toy Lua API"
TOC_Official (talk | contribs) m |
(Enter a short summary [b]) |
||
(9 intermediate revisions by 5 users not shown) | |||
Line 1: | Line 1: | ||
{{Languages|Powder Toy Lua API}} | {{Languages|Powder Toy Lua API}} | ||
− | The Powder Toy Lua API is a set of objects and functions that | + | The Powder Toy Lua API is a set of objects and functions that allow control over most aspects of the game, including graphics, element interactions, and interfaces. |
− | + | If you are new to the Lua programming language, you should familiarize yourself with how to code in Lua. A great beginner's tutorial is available [https://www.lua.org/pil/contents.html here] | |
− | + | ||
+ | If you are using an editor that supports the [https://microsoft.github.io/language-server-protocol/implementors/tools/ Language Server Protocol] like VSCode, you can get completions for the lua API [https://github.com/Maticzpl/TPT-LuaAPI-Addon?tab=readme-ov-file#usage here] | ||
The API is split into several categories | The API is split into several categories | ||
− | ; [[Lua_API: | + | ; [[Lua_API:Simulation|Simulation]] |
− | + | : Methods for modifying the state of the simulation. | |
− | |||
− | : Methods | ||
; [[Lua_API:Elements|Elements]] | ; [[Lua_API:Elements|Elements]] | ||
− | : Methods and constants for modifying and creating elements | + | : Methods and constants for modifying and creating elements. |
− | |||
− | |||
; [[Lua_API:Graphics|Graphics]] | ; [[Lua_API:Graphics|Graphics]] | ||
− | : Methods for drawing simple shapes and text on screen. | + | : Methods for drawing simple shapes and text on the screen. |
+ | ; [[Lua_API:Renderer|Renderer]] | ||
+ | : Methods and constants for interacting with the display mode. | ||
+ | ; [[Lua_API:Event|Event]] | ||
+ | : Listen for events, such as mouse clicks or key presses. | ||
+ | ; [[Lua_API:Interface|Interface]] | ||
+ | : Includes UI components such as buttons, labels, and checkboxes, access to the very primitive window manager, and input events. | ||
; [[Lua_API:File_System|File System]] | ; [[Lua_API:File_System|File System]] | ||
− | : Functions for creating, deleting, modifying and enumerating files and folders. | + | : Functions for creating, deleting, modifying, and enumerating files and folders. |
; [[Lua_API:Platform|Platform]] | ; [[Lua_API:Platform|Platform]] | ||
: Functions for doing OS-level things like opening URLs or interacting with the clipboard. | : Functions for doing OS-level things like opening URLs or interacting with the clipboard. | ||
− | ; [[Lua_API: | + | ; [[Lua_API:Socket|Socket]] |
− | : | + | : Provides TCP sockets, effectively a severely feature-limited version of the [http://w3.impa.br/~diego/software/luasocket/ LuaSocket library] |
− | |||
− | |||
; [[Lua_API:HTTP|HTTP]] | ; [[Lua_API:HTTP|HTTP]] | ||
: Provides access to basic HTTP functionality in the form of request objects. | : Provides access to basic HTTP functionality in the form of request objects. | ||
+ | ; [[Lua_API:Bz2|Bzip2]] | ||
+ | : Provides direct access to our bzip2 library, for compressing and decompressing data. | ||
; [[Lua_API:Bit|Bit]] | ; [[Lua_API:Bit|Bit]] | ||
: Doesn't actually provide any interaction with the game, but provides some functions for performing bitwise operations on integer numbers. | : Doesn't actually provide any interaction with the game, but provides some functions for performing bitwise operations on integer numbers. |
Latest revision as of 17:21, 29 March 2024
Language: | English • 한국어 • 中文 |
---|
The Powder Toy Lua API is a set of objects and functions that allow control over most aspects of the game, including graphics, element interactions, and interfaces.
If you are new to the Lua programming language, you should familiarize yourself with how to code in Lua. A great beginner's tutorial is available here
If you are using an editor that supports the Language Server Protocol like VSCode, you can get completions for the lua API here
The API is split into several categories
- Simulation
- Methods for modifying the state of the simulation.
- Elements
- Methods and constants for modifying and creating elements.
- Graphics
- Methods for drawing simple shapes and text on the screen.
- Renderer
- Methods and constants for interacting with the display mode.
- Event
- Listen for events, such as mouse clicks or key presses.
- Interface
- Includes UI components such as buttons, labels, and checkboxes, access to the very primitive window manager, and input events.
- File System
- Functions for creating, deleting, modifying, and enumerating files and folders.
- Platform
- Functions for doing OS-level things like opening URLs or interacting with the clipboard.
- Socket
- Provides TCP sockets, effectively a severely feature-limited version of the LuaSocket library
- HTTP
- Provides access to basic HTTP functionality in the form of request objects.
- Bzip2
- Provides direct access to our bzip2 library, for compressing and decompressing data.
- Bit
- Doesn't actually provide any interaction with the game, but provides some functions for performing bitwise operations on integer numbers.
- Legacy
- Old Lua API with the tpt.* prefix