This video is part 2 of a series:

  1. Lua Style Guide
    1. Formatting with StyLua
  2. Lua Scripting Best Practices ← You Are Here
  3. Organizing Lua Code With Modules

Setting up VS Code Environment

Writing Lua for Dream Editor Projects

Our game engine uses Lua to build game logic. Lua is a widely-used lightweight scripting system focused on speed and ease-of-use. Lua is widely documented and googling “How do I do X in Lua” usually returns useful results.

Install VS Code

To write lua scripts you should first install Visual Studio Code, an excellent, free, cross-platform code editor. When installing VS Code, be sure to check the “Add ‘Open with Code’ to Windows Explorer” option, as it will make your life easier in the future.

You may have a preferred code editor; but we only support our DreamEditor extension for VS Code.

  1. Download and install VS Code.
  2. Next, install the Funovus Lua extension. (See: Lua Plugin Setup)
  3. Finally, install and set up the StyLua extension. (See: Formatting with StyLua)

We also recommend Code Spell Checker (or a similar alternative).

There are several ways of implementing classes and tutorials for object-oriented Lua programming. This can help you write cleaner code that is easier to read and maintain. Note that we use Lua 5.3.

Style

Be sure to follow our style guide: Lua Style Guide

Coding Guidelines

This guide aims to standardize the coding practices of all our of game designers across the design team under the same principles, styling, and conventions. These principles are to encourage good coding practices for readable, scalable code.

Code Best Practices