Перейти к содержанию

Модуль:NBT

Материал из LemonCraft Wiki

Для документации этого модуля может быть создана страница Модуль:NBT/doc

local p = {}

local nbt_types = {
	"TAG_Byte",
	"TAG_Double",
	"TAG_Float",
	"TAG_Int",
	"TAG_Long",
	"TAG_Short",
	"TAG_String",
	"TAG_Compound",
	"TAG_Byte_Array",
	"TAG_Int_Array",
	"TAG_List",
	"TAG_Boolean"
}

function p.sprite(f)
	local args = f
	if f == mw.getCurrentFrame() then
		args = require("Модуль:ProcessArgs").merge(true)
	end
	
	local sprite = require("Модуль:Спрайт").sprite
	local pos = args[1]
	local text = args[2]
	if text then
		text = "'''" .. text .. "'''"
	end
	
	local title = pos
	if type(pos) == "number" then
		title = nbt_types[number] or "ОШИБКА"
	end
	
	local thesprite, categories = sprite{pos, ["разм"] = 32, ["формат"] = 128, ["масштаб"] = 0.5, ["данные"] = "NBTСпрайт", ["выравн"] = "text-top", ["назв"] = title, ["текст"] = text}
	
	local entireS = thesprite
	if (args["некат"] or "") == "" then
		entireS = entireS .. categories
	end
	return entireS
end

return p