모듈:글상자

Caeruleum (토론 | 기여)님의 2021년 6월 6일 (일) 13:37 판
설명문서 [편집] [역사] [새로고침]

15번째 줄에서 Lua 오류: attempt to index field 'signals' (a nil value).

연습장이나 사용자 문서에서 틀의 사용이나 수정을 연습할 수 있습니다.
분류는 /설명문서에 넣어주세요.

local p = {}
local table_ =  {
	scales = {}, axes = {}, marks = {}
}

table_.width = 400
table_.height = 300

table_.signals[1] = { name = "tooltip",
	value = {},
	on = {
		{events = "rect:mouseover", update =  "datum"},
		{events = "rect:mouseout",  update = "{}"}
	}
}
--[[table_.data = {
			{
			name = "table", 
			valus = {
				{category = "USB 3.2 Gen 2x2", amount = 20}, 
				{category = "USB 3.2 Gen 2(구 명칭 USB 3.1 Gen2, USB 3.1)", amount = 10}, 
        		{category =  "USB 3.2 Gen 1(구 명칭 USB 3.1 Gen 1, USB 3.0) ", amount = 5}, 
        		{category = "USB 2.0", amount = 0.480}, 
        		{category = "USB 1.0" , amount = 0.12}
			}
		}
}
table_.scales = {
		{
      name = "x",
      range = "width",
      domain= {data= "table", field= "amount"},
      round= true
    },
    {
      name = "y",
      range = "height",
      type = "ordinal",
      domain= {data= "table", field = "category"},
      padding=  0.3,
      round= true
    }
}]]

function p.jsonDecode()
	return 0
	--mw.text.jsonDecode()
end
function p.jsonEncode()
	return mw.text.jsonEncode(table_)

end

function p.textDecode(frame)
	return mw.text.decode(frame.args[1])
end
function p.textSplit(frame)
	return mw.text.split(frame.args[1], frame.args[2], frame.args[3] or "")
end

local vertical_p = {}

function vertical_p.main(frame)
	local str = ""
	local i, j = 1, 1
	
	while frame.args[i] do
		str = str..[[<div class="vertical_p" style="float:left;">]]..frame.args[i]..[[</div>]]
		i = i + 1
	end
	return str
end

--return vertical_p
return p