Introduction

Prerequisites

To create a mod, you first need to learn Lua. If you don't know Lua, you can either search video tutorials on websites like YouTube or just search a text tutorial using a search engine.

The Get Started page or a Lua Tutorial (maybe Tutorialspoint's tutorial?), once you get a grasp of Lua, you can start modding Blocksworld!

You don't need to install any software to code in Lua, just open Notepad (or better, Notepad++) and you're ready to go!

Creating a mod

Each Lua mod is in a directory. So to create a mod, you will have first to create a directory, the directory's name can only contain alphabetical characters (A to Z, upper case and lower case), digits (0 to 9) and underscores.

Once it is created you MUST move it to (Documents)/blocksworld_develop/user_[somenumber]/user/lua_mods

Where (Documents) is your Documents folder.

To name the file init.lua do not forget to enable file extensions in Windows Explorer.

To create a mod you just have to create an init.lua file:

name = "Tutorial Mod"
dependencies = {
    {"exdilin", ">0.5.0"}
}

As you learnt Lua, you might have spoted that name and dependencies are global variables. This is necessary and they should not be set as local variables.

As you might have guessed, the name variable is the mod's name, dependencies is something we will see later, all this mean for now is that the mod needs to run on Exdilin 0.5.0 (the first version to support Lua mods).

Now to make actual modding requires you to grasp the Modding Concepts.

Pre-Initialization

Pre-initialization (see Initialization orders) is an important step and is where we will register most things.

Let's add a pre-init function, replace the file content's with the following:

name = "Tutorial Mod"
dependencies = {
    {"exdilin", ">0.5.0"}
}

function pre_init()
    
end

Great! In the next chapter, we will add blocks.

Last updated