Modding:Lua

From Starbounder - Starbound Wiki
Jump to: navigation, search

About Lua

Lua is a powerful, fast, lightweight, embeddable scripting language used to extend the functionality of software and games.

The official website has this to say:

Lua is a powerful, fast, lightweight, embeddable scripting language.

Lua combines simple procedural syntax with powerful data description constructs based on associative arrays and extensible semantics. Lua is dynamically typed, runs by interpreting bytecode for a register-based virtual machine, and has automatic memory management with incremental garbage collection, making it ideal for configuration, scripting, and rapid prototyping.

To learn how to program Lua, the Lua-users wiki might be a good place to start, or just Google search, "Learning Lua." There are many good, free, online options.

Lua Reference

Modding:Lua/Starbound Datatypes

Tables

The Lua API consists mostly of tables that contain references to the required functions.

Activeitem Commandprocessor Message Physics Scriptpane Utility
Activeitemanimation Config Monster Player Stagehand Vehicle
Actormovementcontroller Containerpane Movementcontroller Playercompanions Statuscontroller Widget
Animationconfig Entity Npc Projectile Statuseffect World
Animator Item Object Quest Tech
Celestial Localanimator Objectanimator Root Updatablescript


Hooks & Callbacks

Entities like NPCs, objects and monsters require some functions to work.

Monster NPC Object Fireable Items Tech


Libraries

These are libraries containing "utilitary" functions and scripts, for coding convenience.

Starbound already provides a bunch in /scripts/



- Tech Keybinds is an easy to use library that allows tech modders to bind input values to functions.

- Storm_UI is used by StormyUK for his Macrochip mod's U.I.

- PenguinToast's PenguinGUI is a pretty old library to make custom U.I.s updated for 1.3 (original version and infos can be found here.)

- StardustLib is a bunch of scripts zetaPRIME uses for his StardustSuite mod.


Additional Information

If you could not find a function documented here, chances are that you will find some documentation in the following sources:

  • The official documentation, which can be found in the game folder: /Starbound/doc/lua
  • Searching how a function is used in the assets, with tools such as Agent Ransack or similar on Windows, or the grep -r command on Linux and Mac.
  • Any .lua file used by the default assets or other modders.


Quick Navigation