(새 문서: --출력할 값을 담고 있다가 한번에 출력하는 모듈 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, ...) -- 입력받은...)
 
잔글 ("모듈:Coutput" 문서를 보호했습니다 ([편집=관리자만 허용] (무기한) [이동=관리자만 허용] (무기한)))
 
(차이 없음)

2023년 9월 13일 (수) 01:13 기준 최신판

이 모듈에 대한 설명문서는 모듈: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