Tutorial - include-marcy/luau-class-generator GitHub Wiki

Tutorial

Visual Studio Code is sometimes a confusing and perplexing piece of software, so I am writing this tutorial for you so that there is minimal confusion surrounding the tool luau-class-generator.

The Steps

Prerequisites

  1. Ensure you have installed Visual Studio Code.
  2. Ensure you have installed and are familiar with Rojo and Roblox Studio. Link a Rojo project.json to a Roblox Studio .rbxl.
  3. Install this extension using the Visual Studio Code Marketplace

Project Configuration

  1. Inside your repository, create a file for the type outputs, with either the .lua or .luau file extension types.
  2. Right click the file, and select the option LCG: Set Types File (see fig. A) to configure this file as the "Library Types" module.

Figure A.

  1. Visit the configurations page (fig. B) to change the output of the luau-class-generator to your liking.

Figure B.

  • Here you can configure:
    • The license name to administer in each file at the top
    • Luau Dynamic Fast Flags and Luau Fast Flags
    • Library Name
    • Library Prefix
    • Comment Detail Levels

Using the luau-class-generator Visual Studio Code Extension

  1. Right click any .luau or .lua file and select the method LCG: New Class to create a new Luau class with fully initialized boiler plate.

NOTE: Right click any folder and select LCG: New File + Class to be prompted to enter a class name and description and the extension will also create a new file and class automatically for you.

  1. You may be prompted to rename the file to include the Library Prefix at the beginning of the name of your class. It is up to you whether you wish to include this.
  2. You will be prompted to include a general description of the class at its creation.
  3. Right click any file which has generated a class and select LCG: New Method to add a new method. You will be prompted to give your method a name and general description. It will generate boiler plate and comment descriptions (see fig. C) for you.

Figure C.
⚠️ **GitHub.com Fallback** ⚠️