Skip to content

Quickstart

Let’s make a simple Luau program that uses the pesde/hello package to print hello to the terminal.

Scaffolding the project

In your terminal, run the following commands to create a folder and navigate into it.

Terminal window
mkdir hello-pesde
cd hello-pesde

Then, we’ll use pesde init to scaffold a new pesde project. The command will ask you a few questions to set up the project. Our project will be named <username>/hello_pesde, replace <username> with a username of your choice. The name may only contain lowercase letters, numbers, and underscores. The environment we’re targeting is luau.

Terminal window
pesde init
# what is the name of the project? <username>/hello_pesde
# what is the description of the project?
# who are the authors of this project?
# what is the repository URL of this project?
# what is the license of this project? MIT
# what environment are you targeting for your package? luau
# would you like to setup Roblox compatibility scripts? No

The command will create a pesde.toml file in the current folder. Go ahead and open this file in your text editor of choice.

Adding a main script

Under the [target] section, we’re going to add a bin field to specify the path to the main script of our package.

pesde.toml
name = "<username>/hello_pesde"
version = "0.1.0"
license = "MIT"
[target]
environment = "luau"
bin = "main.luau"
[indices]
default = "https://github.com/pesde-pkg/index"

Don’t forget to save the file after making the changes.

Now, lets create a main.luau file in the project folder and add the following code to it.

main.luau
print("Hello, pesde!")

Running the script

Then, we can run the following command to run the script.

Terminal window
pesde run

You should see Hello, pesde! printed to the terminal.

Install a dependency

Let’s use the pesde/hello package instead of printing ourselves.

Run the following command to add the package to pesde.toml.

Terminal window
pesde add pesde/hello

You should see that pesde.toml has been updated with the new dependency.

pesde.toml
name = "lukadev_0/hello_pesde"
version = "0.1.0"
license = "MIT"
[target]
environment = "luau"
bin = "main.luau"
[indices]
default = "https://github.com/pesde-pkg/index"
[dependencies]
hello = { name = "pesde/hello", version = "^1.0.0" }

Run the following command to install the new dependency.

Terminal window
pesde install

You should see that pesde has created a luau_packages folder containing the newly installed package. It has also created a pesde.lock file, this file contains the exact versions of the dependencies that were installed so that they can be installed again in the future.

  • Directoryluau_packages/
    • hello.luau
  • main.luau
  • pesde.lock
  • pesde.toml

Let’s update the main.luau file to use the pesde/hello package.

main.luau
local hello = require("./luau_packages/hello")
hello()

If we run the script again, we should see something printed to the terminal.

Terminal window
pesde run
# Hello, pesde! (pesde/[email protected], luau)