Skip to content

Commit b5dc5ba

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

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
@@ -3,6 +3,7 @@
33
-- It can be run using a standard lua interpreter, although LuaJIT is preferable
44

55

6+
67
-- Callbacks
78
local callbackTable = { }
89
local mainObject
@@ -209,11 +210,15 @@ function loadBuildFromXML(xmlText, name)
209210
mainObject.main:SetMode("BUILD", false, name or "", xmlText)
210211
runCallback("OnFrame")
211212
end
212-
function loadBuildFromJSON(getItemsJSON, getPassiveSkillsJSON)
213+
function loadBuildFromJSON(characterJSON)
213214
mainObject.main:SetMode("BUILD", false, "")
214215
runCallback("OnFrame")
215-
local charData = build.importTab:ImportItemsAndSkills(getItemsJSON)
216-
build.importTab:ImportPassiveTreeAndJewels(getPassiveSkillsJSON, charData)
216+
-- characterJSON could, for example, be the response from the PoE API:
217+
-- https://www.pathofexile.com/developer/docs/reference#characters-get
218+
local dkjson = require "dkjson"
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)