Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
15de789
Add global API type hints
vaisest May 19, 2026
33673d2
Update .emmyrc.json instructions
vaisest May 19, 2026
8c9af4b
Fix typo
vaisest May 19, 2026
84f4ee4
Add missing func parameters and recommend skipping the rest of the tests
vaisest May 19, 2026
9d6a661
Fix definition file
vaisest May 19, 2026
e63a949
Improve type hinting for classes by:
vaisest May 19, 2026
539e720
Add lsp config to gitignore
vaisest May 20, 2026
c36c6a4
Change class constructor to be added as a separate method, instead of…
vaisest May 20, 2026
a275be6
Declare Build as a type
vaisest May 20, 2026
131fe12
Move HeadlessWrapper.lua dummy functions to def file
vaisest May 20, 2026
51c8926
Add more handle class type hints, and fix typo
vaisest May 20, 2026
5d76d72
Misc fixes
vaisest May 20, 2026
c3112b6
Require self to be supplied to parent constructors manually (using `:…
vaisest May 20, 2026
8d59bc8
Change class constructors to call the constructor directly, instead o…
vaisest May 21, 2026
47e1dea
Update data export class definitions
vaisest May 21, 2026
8267d74
Update def file callback variable
vaisest May 21, 2026
55e2420
Describe emmylua alternative in CONTRIBUTING.md
vaisest May 21, 2026
aa0822e
Explicitly return self from constructors to preserve type information
vaisest May 21, 2026
f7f8236
Fix control type hint and toastnotification constructor syntax
vaisest May 21, 2026
3fe3e7b
Recommend avoiding HeadlessWrapper for language server
vaisest May 21, 2026
d4cc694
Remove varargs from new() and recommend treating LoadModule like requ…
vaisest May 25, 2026
0f6fa94
Recommend some luals addons for test framework definitions
vaisest May 25, 2026
27fbc51
Fix cspell error and add mod type examples
vaisest May 26, 2026
37b13cd
White space fixes
vaisest May 26, 2026
d144dc5
Add missing SimpleGraphic definitions and recommend including them as…
vaisest Jun 14, 2026
29b5dab
Convert all modules to be compatible with require()
vaisest Jun 14, 2026
92bc61b
Fix typo
vaisest Jun 14, 2026
90ab8d1
Remove print from def file
vaisest Jun 14, 2026
5d1d848
Fix tests
vaisest Jun 14, 2026
600516d
Disable test. Fixed in another PR
vaisest Jun 14, 2026
fb024a1
Fix modCache being dropped during load
vaisest Jun 14, 2026
31e5f62
Fix update script
vaisest Jun 14, 2026
977acba
Fix calc typos
vaisest Jun 14, 2026
8e52eff
Add GetVirtualScreenSize for headless mode
vaisest Jun 14, 2026
fc69a1e
Add some more docs: simplegraphic api, native busted
vaisest Jul 8, 2026
c8a10e8
Add test for uninitialised parent class error
vaisest Jul 9, 2026
085b6b9
Export scalability
vaisest Jul 10, 2026
9510eca
Port the rest of the owl
vaisest Jul 10, 2026
5316569
Don't scale lines that don't scale
vaisest Jul 11, 2026
9c1495a
Add item parsing handling, fix corruptItem(), and apply range in form…
vaisest Jul 11, 2026
46abb0a
Regenerate modcache
vaisest Jul 11, 2026
bd3661f
Fix filter logic
vaisest Jul 11, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ luajit/
spec/test_results.log
spec/test_generation.log
src/luacov.stats.out
runtime/lua/debugger.lua

# Release
manifest-updated.xml
Expand All @@ -37,3 +38,7 @@ src/Data/TimelessJewelData/*.bin
# Simplegraphic Debugging
runtime/imgui.ini
runtime/SimpleGraphic/SimpleGraphic.log
runtime/SimpleGraphic/Screenshots

.emmyrc.json
.luarc.json
93 changes: 91 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,14 @@ It is recommended to use it over the built-in Lua plugins.
Please note that EmmyLua is not available for other editors based on Visual Studio Code,
such as [VSCodium](https://vscodium.com) or [Eclipse Theia](https://theia-ide.org) but can be built from source if needed.

Another alternative on VSCode is to use [sumneko's Lua language server](https://marketplace.visualstudio.com/items?itemName=sumneko.lua) along with [actboy168's debugger](https://marketplace.visualstudio.com/items?itemName=actboy168.lua-debug). These can potentially offer more features than EmmyLua, such as conditional breakpoints.

## Runtime environment

It is recommended that you configure your IDE to include `src/_SimpleGraphic.def.lua` somehow. Path of Building runs inside a special Lua environment via SimpleGraphic which implements a small API. These are not defined inside the project, which means that the aforementioned meta/hint file is required for the IDE to know which functions exist. As the file is not included in code, it must be explicitly mentioned as a library in whichever language server you are using, or otherwise it will not be read.

This file is normally not executed, but does contain basic implementations for parts of the API, which allows many parts of PoB to work without running inside SimpleGraphic. If you wish to test individual changes, it might be possible to do so through a script using Luajit directly. To do so, see HeadlessWrapper.lua for an example. It should be noted that some parts of the API (such as subscripts) are not implemented, which means some parts of PoB are unusable.

### Visual Studio Code

1. Create a new <kbd>Debug Configuration</kbd> of type <kbd>EmmyLua New Debug</kbd>
Expand Down Expand Up @@ -168,20 +176,54 @@ such as [VSCodium](https://vscodium.com) or [Eclipse Theia](https://theia-ide.or
1. In VSCode click <kbd>Start Debugging</kbd> (the green icon) or press <kbd>F5</kbd>
1. The debugger should connect

You might also want to use actboy168 debugger. This is possible by using for example the following launch.json configuration:

```json
{
"version": "0.2.0",
"configurations": [
{
"name": "🍄attach",
"type": "lua",
"request": "attach",
"stopOnEntry": false,
"address": "127.0.0.1:12306",
"luaVersion": "luajit",
},

]
}
```

Then, similarly to the EmmyLua example:

1. Find the sub-folder that looks like `actboy168.lua-debug-x.y.z-win32-x64` in `%USERPROFILE%/.vscode/extensions`. Navigate to it and find the `debugger.lua` script under the script folder. Copy this to `runtime/lua`.
2. Copy-paste the following code snippet into `launch:OnInit()`:
```lua
local debugger = require("debugger"):start("127.0.0.1:12306")
-- debugger:event("wait") -- Uncomment this line if you want PoB to wait until the debugger is attached.
```


#### Excluding directories from EmmyLua

Depending on the amount of system ram you have available and the amount that gets assigned to the jvm running the emmylua language server you might run into issues when trying to debug Path of building.
Files in `/Data` `/Export` and `/TreeData` can be massive and cause the EmmyLua language server to use a significant amount of memory. Sometimes causing the language server to crash. To avoid this and speed up initialization consider adding an `.emmyrc.json` file to the `.vscode` folder in the root of the Path of building folder with the following content:
Files in `/Data` `/Export` and `/TreeData` can be massive and cause the EmmyLua language server to use a significant amount of memory. Sometimes causing the language server to crash. To avoid this and speed up initialization consider adding an `.emmyrc.json` to the root of the Path of building folder with the following content:

```json
{
"$schema": "https://raw.githubusercontent.com/EmmyLuaLs/emmylua-analyzer-rust/refs/heads/main/crates/emmylua_code_analysis/resources/schema.json",
"runtime": {
"version": "LuaJIT"
"version": "LuaJIT",
// this is not technically correct as LoadModule behaviour can
// differ from require, but it is useful for now
"requireLikeFunction": ["LoadModule"],
},
"workspace": {
"ignoreGlobs": [
"**/*_spec.lua",
"spec/**/*.lua",
"runtime/lua/sha1/lua53_ops.lua",
"**/src/Data/**/*.lua",
"**/src/TreeData/**/*.lua",
"**/src/Modules/ModParser.lua"
Expand All @@ -190,6 +232,46 @@ Files in `/Data` `/Export` and `/TreeData` can be massive and cause the EmmyLua
}
```

This file can be customised according to what you want. It is a good idea to ignore test files as these tend to add things to the global namespace, which will look confusing, and they are designed to be run by Busted. `lua53_ops.lua` produces errors and doesn't actually get imported when using LuaJIT. It can be useful to keep the data and mod parser files, but generally this will increase the time the LSP takes to index the project on startup.

### Excluding directories from Sumneko's language server

If you prefer to not use EmmyLua, the following configuration works well for Sumneko's VS Code extension:

```json
{
"Lua.workspace.ignoreDir": [
".vscode",
// these files add things to global that aren't there in normal
// operation
"spec/*",
"src/Export/*",
"src/HeadlessWrapper.lua",

// this has lua 5.3 code which produces errors, but doesn't actually run
"src/runtime/lua/sha1/*",

// avoid overriding the below library setting
"src/_SimpleGraphic.def.lua",
],
"Lua.diagnostics.disable": ["inject-field"],
// disables diagnostics even when you open one of the above
"Lua.diagnostics.ignoredFiles": "Disable",
"Lua.runtime.version": "LuaJIT",
"Lua.workspace.preloadFileSize": 1000,
// this is not technically correct as LoadModule behaviour can
// differ from require, but it is useful for now
"Lua.runtime.special": {
"LoadModule": "require"
},
"Lua.workspace.library": [
"src/_SimpleGraphic.def.lua"
],
}
```

The extension will automatically skip large files from being preloaded (controlled by `Lua.workspace.preloadFileSize`), so they don't have to be excluded. The configuration file can be found by pressing Ctrl-Shift-P and selecting `Preferences: Open Workspace Settings (JSON)`. If you wish to check test files, you can remove the "ignoredFiles" option and install the busted, LuaFileSystem, and luassert LuaLS addons through `Lua: Open Addon Manager`.

### PyCharm Community / IntelliJ Idea Community

1. Create a new "Debug Configuration" of type "Emmy Debugger(NEW)".
Expand Down Expand Up @@ -223,6 +305,13 @@ More tests can be added to this folder to test specific functionality, or new te

Please try to include tests for your new features in your pull request. Additionally, if your pr breaks a test that should be passing please update it accordingly.

It can also be a good idea to install `busted` locally as it tends to be faster to execute:

1. Install Luajit (due to PoB accessing the jit library, it non-Luajit versions might not work)
2. Install [Luarocks](https://luarocks.org/) (for example, through Scoop or your Linux package manager)
3. Run `luarocks install busted`
4. Run `busted --lua=luajit` to run the tests. You can also use e.g. `-p TestUtils_spec.lua` to run a specific file.

### Debugging tests
When running tests with a docker container it is possible to use EmmyLua for debugging. Paste in the following right under `function launch:OnInit()` in `./src/Launch.lua`:
```lua
Expand Down
21 changes: 21 additions & 0 deletions spec/System/TestCommon_spec.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
describe("Common", function()
describe("Class creation and use", function()
it("produces error when parent constructors are not called", function ()
local ParentClass = newClass("ConstructorTestParentClass")
function ParentClass:ConstructorTestParentClass()
end
local ChildClass = newClass("ConstructorTestProblemChildClass", "ConstructorTestParentClass")
function ChildClass:ConstructorTestProblemChild()
-- Intentionally does not call self:ConstructorTestParentClass()
end
common.classes.ConstructorTestParent = ParentClass
common.classes.ConstructorTestProblemChild = ChildClass

assert.has_error(function()
new("ConstructorTestProblemChild"):ConstructorTestProblemChild()
end, "Parent class 'ConstructorTestParentClass' of class 'ConstructorTestProblemChild' must be initialised")
common.classes.ConstructorTestParent = nil
common.classes.ConstructorTestProblemChild = nil
end)
end)
end)
Loading
Loading