Skip to content

Commit 1331434

Browse files
committed
change headless wrapper example (untested otherwise)
1 parent 088b213 commit 1331434

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

src/HeadlessWrapper.lua

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
-- This wrapper allows the program to run headless on any OS (in theory)
33
-- It can be run using a standard lua interpreter, although LuaJIT is preferable
44

5+
local dkjson = require("runtime.lua.dkjson")
6+
57

68
-- Callbacks
79
local callbackTable = { }
@@ -209,11 +211,14 @@ function loadBuildFromXML(xmlText, name)
209211
mainObject.main:SetMode("BUILD", false, name or "", xmlText)
210212
runCallback("OnFrame")
211213
end
212-
function loadBuildFromJSON(getItemsJSON, getPassiveSkillsJSON)
214+
function loadBuildFromJSON(characterJSON)
213215
mainObject.main:SetMode("BUILD", false, "")
214216
runCallback("OnFrame")
215-
local charData = build.importTab:ImportItemsAndSkills(getItemsJSON)
216-
build.importTab:ImportPassiveTreeAndJewels(getPassiveSkillsJSON, charData)
217+
-- characterJSON could, for example, be the response from the PoE API:
218+
-- https://www.pathofexile.com/developer/docs/reference#characters-get
219+
local input = dkjson.decode(characterJSON)
220+
local charData = build.importTab:ImportItemsAndSkills(input)
221+
build.importTab:ImportPassiveTreeAndJewels(input)
217222
-- You now have a build without a correct main skill selected, or any configuration options set
218223
-- Good luck!
219224
end

0 commit comments

Comments
 (0)