# Getting Started

## How to install the main module

1.) Go to the repository's releases page and download the latest version of isaac-helper. Choose `isaac-helper.min.zip` if you want a minified version.

2.) Extract the .zip file you downloaded in a folder within your mod with the same name as your mod's master folder. For example:

```
mod-name/
├── main.lua (the main lua file for your mod)
├── metadata.xml (steam workshop file)
└── mod-name/ (the same name as your mod folder)
    └── isaac-helper/
        ├── init.lua
        └── Modules/
```

It can be within a subdirectory of `mod-name/mod-name`, but for this example we're going to put it directly under `mod-name/mod-name`.

### How to install submodules

1.) Find the submodule you want to use in this folder on the Github repo. For example, if you want to use the `ExtraMath` submodule, you would go to `Source/Modules/ExtraMath/ExtraMath.lua`.

2.) Download the submodule.

2a.) If the submodule has dependencies, check the README file to find out what they are and download them as well.

3.) Put the submodules and its dependencies in the `Modules` folder in the `isaac-helper` folder. For example:

```
mod-name/
├── main.lua (the main lua file for your mod)
├── metadata.xml (steam workshop file)
└── mod-name/ (the same name as your mod folder)
    └── isaac-helper/
        ├── init.lua
        └── Modules/
            └── ExtraMath.lua
```

## How to use

1.) `require` the main module

{% code overflow="wrap" lineNumbers="true" %}

```lua
local MyMod = RegisterMod("MyMod", 1)
local IsaacHelperPath = "path.to.isaac-helper" -- replace with the actual path, starting from your mod folder
local IsaacHelper = require(IsaacHelperPath .. "init") -- get the actual lua file you need
```

{% endcode %}

2.) If this is the `main.lua` file, initialize the main module with your mod reference and folder name. **Otherwise, skip this step.**

{% code lineNumbers="true" %}

```lua
IsaacHelper.Init(MyMod, IsaacHelperPath)
```

{% endcode %}

3.) Get the submodule you want to use.

{% code lineNumbers="true" %}

```lua
local ExtraMath = IsaacHelper.GetModule(IsaacHelper.Submodules.EXTRA_MATH)
```

{% endcode %}

#### Example use

{% code overflow="wrap" lineNumbers="true" %}

```lua
local MyMod = RegisterMod("MyMod", 1)
local IsaacHelperPath = "path.to.isaac-helper" -- replace with the actual path, starting from your mod folder
local IsaacHelper = require(IsaacHelperPath .. "init") -- get the actual lua file you need

IsaacHelper.Init(MyMod, IsaacHelperPath)

local ExtraMath = IsaacHelper.GetModule(IsaacHelper.Submodules.EXTRA_MATH)

-- Example using ExtraMath
local foo = 25
local bar = ExtraMath.Clamp(foo, 0, 10)

print(bar) -- prints 10
```

{% endcode %}

Because of how the main module loads its submodules and how you initialize the main module on mod startup, `luamod your-mod-name` **will work** with isaac-helperr.

## What now?

Just install the submodules you want to use. [You can find an encyclopedia of every submodule and their purpose here.](https://maya-bee.gitbook.io/api-docs/reference/documentation)
