Difference between revisions of "Powder Toy Lua API"

From The Powder Toy
Jump to: navigation, search
(Link luasocket reference manual)
 
(13 intermediate revisions by 10 users not shown)
Line 1: Line 1:
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.
+
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 [https://www.boxmein.net/tpt/tptelements/reference/lua-reference.html here].
  
 
The API is split into several categories
 
The API is split into several categories
Line 8: Line 11:
 
; [[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:Simulation|Simulation]]
 +
: Methods for modifying the state of the simulation
 
; [[Lua_API:Graphics|Graphics]]
 
; [[Lua_API:Graphics|Graphics]]
: Methods and constants for modifying and creating elements
+
: Methods for drawing simple shapes and text on screen.
 
; [[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]]
 +
: Functions for doing OS-level things like opening URLs or interacting with the clipboard.
 +
; [[Lua_API:Event|Event]]
 +
: Listen for events, such as mouseclicks or key presses.
 +
; [http://w3.impa.br/~diego/software/luasocket/ Socket]
 +
: Built-in LuaSocket library available as the <code>socket</code> global.
 +
; [[Lua_API:HTTP|HTTP]]
 +
: Provides access to basic HTTP functionality in the form of request objects.
 
; [[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 22:28, 20 December 2020

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

Interface
Includes UI components such as buttons, labels and checkboxes, access to the very primitive window manager and input events
Renderer
Methods and constants for interacting with the display mode
Elements
Methods and constants for modifying and creating elements
Simulation
Methods for modifying the state of the simulation
Graphics
Methods for drawing simple shapes and text on screen.
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.
Event
Listen for events, such as mouseclicks or key presses.
Socket
Built-in LuaSocket library available as the socket global.
HTTP
Provides access to basic HTTP functionality in the form of request objects.
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