diff --git a/files/capture.lua b/files/capture.lua index c2fd9bf..3519059 100644 --- a/files/capture.lua +++ b/files/capture.lua @@ -10,7 +10,7 @@ local EntityAPI = dofile_once("mods/noita-mapcap/files/libraries/noita-api/entit local Hilbert = dofile_once("mods/noita-mapcap/files/libraries/hilbert-curve.lua") ---@type JSONLib -local json = dofile_once("mods/noita-mapcap/files/libraries/json.lua") +local JSON = dofile_once("mods/noita-mapcap/files/libraries/json.lua") CAPTURE_PIXEL_SIZE = 1 -- Screen to virtual pixel ratio. CAPTURE_GRID_SIZE = 512 -- in virtual (world) pixels. There will always be exactly 4 images overlapping if the virtual resolution is 1024x1024. @@ -93,11 +93,11 @@ local function captureEntities(entityFile, x, y, radius) -- Well, as long as it does not crash between write and flush. if entityFile:seek("end") == 0 then -- First line. - entityFile:write("[\n\t", json.Marshal(rootEntity), "\n", "]") + entityFile:write("[\n\t", JSON.Marshal(rootEntity), "\n", "]") else -- Following lines. entityFile:seek("end", -2) -- Seek a few bytes back, so we can overwrite some stuff. - entityFile:write(",\n\t", json.Marshal(rootEntity), "\n", "]") + entityFile:write(",\n\t", JSON.Marshal(rootEntity), "\n", "]") end -- Prevent recapturing. diff --git a/files/libraries/noita-api/component.lua b/files/libraries/noita-api/component.lua index 369eb04..3eb9e35 100644 --- a/files/libraries/noita-api/component.lua +++ b/files/libraries/noita-api/component.lua @@ -10,7 +10,7 @@ -- It would be optimal to generate this API wrapper automatically... ---@type JSONLib -local json = dofile_once("mods/noita-mapcap/files/libraries/json.lua") +local JSON = dofile_once("mods/noita-mapcap/files/libraries/json.lua") ------------- -- Classes -- @@ -183,7 +183,7 @@ function NoitaComponent:MarshalJSON() --objectMembers = component:ObjectGetMembers } - return json.Marshal(resultObject) + return JSON.Marshal(resultObject) end return ComponentAPI diff --git a/files/libraries/noita-api/entity.lua b/files/libraries/noita-api/entity.lua index ffdc709..669663a 100644 --- a/files/libraries/noita-api/entity.lua +++ b/files/libraries/noita-api/entity.lua @@ -16,7 +16,7 @@ local ComponentAPI = dofile_once("mods/noita-mapcap/files/libraries/noita-api/co local Vec2 = dofile_once("mods/noita-mapcap/files/libraries/vec2.lua") ---@type JSONLib -local json = dofile_once("mods/noita-mapcap/files/libraries/json.lua") +local JSON = dofile_once("mods/noita-mapcap/files/libraries/json.lua") ------------- -- Classes -- @@ -371,7 +371,7 @@ function NoitaEntity:MarshalJSON() result.transform.x, result.transform.y, result.transform.rotation, result.transform.scaleX, result.transform.scaleY = self:GetTransform() - return json.Marshal(result) + return JSON.Marshal(result) end return EntityAPI