Copy
Average TPS: 0 Average FPS: 0
0
0
3x
60
50
Help
Storage used: ?

Official Lua Language Manual

https://www.lua.org/manual/5.3/

Stormworks Lua Manual

Please visit the official wiki: Stormworks Wiki Guide for Lua

Official Game Tutorial

This scripting API is very powerful and as such there are some important reminders to take note of:

  • Your script has a max execution time of 1000 milliseconds, however it is still possible to create scripts that significantly slow down the game. It is your responsibility to ensure your script runs efficiently.
  • Random number functions are provided by the Lua math library. Use of randomness in your scripts is likey to cause desync in multiplayer, so use these functions at your own risk
  • When your vehicle despawns and respawns, your script will be executed "fresh" and any state stored within the script will be lost. We recommend keeping your script as stateless as possible, and making use of existing logic components (e.g. memory register) to store values that you with to persist
  • Your scripts run as a "black box" with only the logic inputs/outputs being synced in multiplayer. Keep in mind that complex logic in your script may behave differently for different players in a multiplayer session.
  • A number of safeguards are in place to sandbox your script, however it is still possible to write scripts that will potentially crash your game. If you crash your game with a script it\'s likely that you\'re doing something (very) wrong. This is your own responsibility. If you suspect you have encountered a legitimate bug, please report it on the Stormworks issue tracker (accessible from the pause-menu).
  • Malicious and harmful scripts will not be tolerated on the Stormworks Steam Workshop
  • ONLY SERVER LUA: Any variables saved to a lua table named g_savedata will be saved out and loaded from a per-save lua_data.xml, you can use this to make your scripts persistent

Learn by topic

Team Insanity - Lua Guide

Line 0, Column 0, Char 0 Autocomplete: right click, Ctrl+Space or Command+Space 0/4096
function onTick() -- your code end function onDraw() -- your code end function httpReply(port, request_body, response_body) -- your code -- -- IMPORTANT: You must follow these steps to enable http support in this Lua IDE: -- the first time you run asyn.httpGet() a popup will explain you what to do -- end
Line 0, Column 0, Char 0 Autocomplete: right click, Ctrl+Space or Command+Space 0/4096
Line 0, Column 0, Char 0 Autocomplete: right click, Ctrl+Space or Command+Space 0/4096
Line 0, Column 0, Char 0 Autocomplete: right click, Ctrl+Space or Command+Space 0/4096
Your code library (persistent and not shared)
function myLibraryFunction() -- write your utility functions in this tab here, and just copy them over into the editor when needed -- they will be highlighted green, so you know you should not change them in the normal editor, but instead in this tab -- perfect if you have code that is used in multiple projects end
Game Preset:

The most important things are explained in the video below. The other things can be discovered while working with the IDE, it's just software, you cannot break it.

In case you actually break it, find a bug or have any suggestions / feedback, i'm happy to hear your feedback.

Discord: CrazyFluffyPony#0587       crazyfluffypony@gmail.com

Sincerly, Pony

Chapters

  • 0:00 Changes compared to the old Lua IDE
  • 1:03 Introduction into the resizable and customizable UI
  • 1:49 Persistent Storage
  • 2:10 Code Editors and Minifying
  • 3:06 UI Builder
  • 4:35 Monitor
  • 5:20 Executing Code
  • 6:58 Touchscreen
  • 7:41 Documentation and Autocompletion
  • 8:41 Properties, Inputs, Outputs
  • 9:40 Learn and Examples and Manuals
  • 10:40 Server Mode / Mission Lua
  • 11:17 Share Code
  • 11:50 Contact, Download Offline, Source Code, HTTP API

Shortcuts / Hotkeys

Ctrl + s Save everything
Ctrl + e Start, continue (when paused) or stop script
Ctrl + p Pause / unpause script
Ctrl + → Step forward (when paused)
close