Module:Sandbox/Erutuon/random

From blackwiki
< Module:Sandbox‎ | Erutuon
Revision as of 21:58, 26 May 2018 by blackwiki>Erutuon (convenient output class)
Jump to navigation Jump to search

Test

  • hello



local p = {}

local Out_mt = {}
Out_mt.__index = Out_mt

function Out_mt:add(item)
	self.i = self.i + 1
	self[self.i] = item
end

function Out_mt:__tostring()
	return table.concat(self)
end

function Out()
	local o = setmetatable({}, Out_mt)
	o.i = 0
	return o
end

function p.show(frame)
	local out = Out()
	out:add('hello')
	return out
end

return p