# 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](https://www.lua.org/start.html) page or a Lua Tutorial (maybe [Tutorialspoint's tutorial](https://www.tutorialspoint.com/lua/index.htm)?), once you get a grasp of Lua, you can start modding Blocksworld!

{% hint style="info" %}
You don't need to install any software to code in Lua, just open Notepad (or better, Notepad++) and you're ready to go!
{% endhint %}

## 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.

{% hint style="info" %}
To name the file `init.lua` do not forget to [enable file extensions in Windows Explorer](https://www.howtogeek.com/205086/beginner-how-to-make-windows-show-file-extensions/).
{% endhint %}

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

```lua
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](/exdilin/concepts/initialization-orders.md)) 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:

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

function pre_init()
    
end
```

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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://zenith391.gitbook.io/exdilin/lua-mods/introduction.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
