模块:沙盒/1F616EMO/LCToPython

维基百科,自由的百科全书
跳转到导航 跳转到搜索
local p = {}

function p.LCToPython(LC)
	local rtn = {"[ x for xs in ["}

	for _, item in ipairs(LC.content) do
		if item.type == "item" then
			rtn[#rtn+1] = "lcparser.converter.from_body(\"" .. item.rule .. "\"),"
		end
	end

	rtn[#rtn+1] = "] for x in xs ]"

	return table.concat(rtn, "")
end

return p