vector formats: comments are specs only
This commit is contained in:
1 parent
d91dc6c597
commit
89a2047349
10 files changed
+34
-126
No files matched your search
@@ -1,6 +1,5 @@
|
||||
--!strict
|
||||
-- vector/tiled/Tmj: the TMJ (JSON) half of vector/tiled: a decoded JSON value <-> a Types.TileMap, and TSJ
|
||||
-- tilesets. JSON map format, Tiled 1.12 docs. Never throws: failures return nil, message, unsupported?.
|
||||
-- vector/tiled/Tmj: TMJ / TSJ (JSON map format, Tiled 1.12 docs) <-> a Types.TileMap.
|
||||
local Types = require("@rosetta/Types")
|
||||
local Data = require("@rosetta/vector/tiled/Data")
|
||||
|
||||
@@ -245,7 +244,6 @@ layer = function(v: any, depth: number): (any, string?, boolean?)
|
||||
return nil, "unknown layer type " .. tostring(v.type)
|
||||
end
|
||||
|
||||
-- tileset(v) -> Tileset (a map's entry, or a .tsj root)
|
||||
function Tmj.tileset(v: any): any
|
||||
local ts: any = {
|
||||
firstGid = n(v.firstgid, 1),
|
||||
@@ -297,7 +295,6 @@ function Tmj.tileset(v: any): any
|
||||
return ts
|
||||
end
|
||||
|
||||
-- read(value) -> TileMap | nil, message, unsupported?
|
||||
function Tmj.read(v: any): (any, string?, boolean?)
|
||||
if type(v) ~= "table" or (v.type ~= nil and v.type ~= "map") then
|
||||
return nil, "not a Tiled map (type is not \"map\")"
|
||||
@@ -535,7 +532,6 @@ writeLayer = function(l: any, o: WriteOptions): (any, string?)
|
||||
return obj(fields), nil
|
||||
end
|
||||
|
||||
-- tilesetValue(ts, inMap) -> a JSON object
|
||||
function Tmj.tilesetValue(ts: any, inMap: boolean): any
|
||||
if inMap and type(ts.source) == "string" then
|
||||
return obj({ { "firstgid", ts.firstGid or 1 }, { "source", ts.source } })
|
||||
@@ -590,7 +586,6 @@ function Tmj.tilesetValue(ts: any, inMap: boolean): any
|
||||
})
|
||||
end
|
||||
|
||||
-- write(map, opts) -> a JSON value | nil, message
|
||||
function Tmj.write(map: any, o: WriteOptions): (any, string?)
|
||||
local layers = {}
|
||||
for _, l in map.layers do
|
||||
|
||||
Reference in new issue
Block a user