모듈:Coutput

이 모듈에 대한 설명문서는 모듈:Coutput/설명문서에서 만들 수 있습니다

--출력할 값을 담고 있다가 한번에 출력하는 모듈
local p = {}
 
function p.print(o, value)
	if type(o) ~= "table" then return p end
	if type(value) == "nil" then return p end 
	o[#o+1]=tostring(value) -- 입력받은 대로 하나씩 저장
	return p --자기 자신을 리턴
end

function p.printf(o, formatstring, ...)
	if type(o) ~= "table" then return p end
	--if type(value) == "nil" then return p end 
	o[#o+1]=string.format(formatstring, ...) -- 입력받은 대로 하나씩 저장
	return p --자기 자신을 리턴
end


function p.printall(o)
	return table.concat(o, "", 1, #o) -- o 테이블에 저장된 값을 모아서 리턴
end

function p.example()
	--[[
	local t ={}
	p.print(t, "안녕하세요!<br />")
	p.print(t, nil)
	p.print(t, "1+1=")
	p.print(t, 1+1)
	return p.printall(t)
	]]
	p:print("안녕하세요!<br />")
	p:print(nil)
	p:print("1+1=")
	p:print(1+1)
	return p:printall()
end

return p
문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}