Skip to content

Commit

Permalink
Merge pull request #412 from Wilma456/ComputerCraft-1/textfix
Browse files Browse the repository at this point in the history
Add Check to textutils.tabulate/pagedTabulate
  • Loading branch information
SquidDev committed Nov 15, 2017
2 parents 1cf10c5 + 282aa80 commit d7301ff
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,15 +113,18 @@ local function tabulateCommon( bPaged, ... )
local tAll = { ... }
for k,v in ipairs( tAll ) do
if type( v ) ~= "number" and type( v ) ~= "table" then
error( "bad argument #"..k.." (expected number/table, got " .. type( v ) .. ")", 3 )
error( "bad argument #"..k.." (expected number or table, got " .. type( v ) .. ")", 3 )
end
end

local w,h = term.getSize()
local nMaxLen = w / 8
for n, t in ipairs( tAll ) do
if type(t) == "table" then
for n, sItem in pairs(t) do
for nu, sItem in pairs(t) do
if type( sItem ) ~= "string" then
error( "bad argument #"..n.."."..nu.." (expected string, got " .. type( sItem ) .. ")", 3 )
end
nMaxLen = math.max( string.len( sItem ) + 1, nMaxLen )
end
end
Expand Down

0 comments on commit d7301ff

Please sign in to comment.