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


Tips & Tricks

Penguin-Jump.gif
Article Stub

This article is a stub. You can help Starbound's official Wiki by expanding it!

There are a lot of obscure details to modding Starbound that bypass some of the limited functionality provided by the Devs. These Tips & Tricks will provide work-arounds for the limited functionality, common mistakes, as well as provide examples.

Tips & Tricks Example Code


Libraries

These are libraries cotnaining "utilitary" functions, for coding convenience.



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 UI.


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.
  • Any .lua file used by the default assets or other modders.


Quick Navigation