function Util.EmulateTabstops(h,C)local I=""for F=1,#h,1 do local b=h:sub(F,F)I=I..(b=="\t"and string.rep(" ",C-#I%C)or b)end return I end function Util.Mutex()local h={}local C=false return function()if C then table.insert(h,coroutine.running())coroutine.yield()else C=true end return function()if#h>0 then coroutine.resume(table.remove(h,1))else C=false end end end end return Util

function Util.EmulateTabstops(text, tabWidth)
	local result = ""
	for i = 1, #text do
		local char = text:sub(i, i)

		result = result .. (char == "\t" and string.rep(" ", tabWidth - #result % tabWidth) or char)
	end
	return result
end

function Util.Mutex()
	local queue = {}
	local locked = false

	return function ()
		if locked then
			table.insert(queue, coroutine.running())
			coroutine.yield()
		else
			locked = true
		end

		return function()
			if #queue > 0 then
				coroutine.resume(table.remove(queue, 1))
			else
				locked = false
			end
		end
	end
end

return Util
