mirror of
				https://github.com/SquidDev-CC/CC-Tweaked
				synced 2025-10-31 05:33:00 +00:00 
			
		
		
		
	Allow strings or numbers in textutils.*tabulate
Allow strings or numbers in textutils.*tabulate A little dubious, but apparently CC used to support it. This means we're consistent with methods like io.write or string.len which accept strings or numbers. Fixes #591
This commit is contained in:
		
							
								
								
									
										12
									
								
								patchwork.md
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								patchwork.md
									
									
									
									
									
								
							| @@ -362,3 +362,15 @@ Remove extra space (#586) | ||||
|  | ||||
| Fixed length check on function name in `expect` (#589) | ||||
| ``` | ||||
|  | ||||
| ``` | ||||
| 04f9644ae75dafc72da4c4790f334d2e90b03e6f | ||||
|  | ||||
| Allow strings or numbers in textutils.*tabulate | ||||
|  | ||||
| A little dubious, but apparently CC used to support it. This means we're | ||||
| consistent with methods like io.write or string.len which accept strings | ||||
| or numbers. | ||||
|  | ||||
| Fixes #591 | ||||
| ``` | ||||
|   | ||||
| @@ -163,10 +163,11 @@ local function tabulateCommon(bPaged, ...) | ||||
|     for n, t in ipairs(tAll) do | ||||
|         if type(t) == "table" then | ||||
|             for nu, sItem in pairs(t) do | ||||
|                 if type(sItem) ~= "string" then | ||||
|                     error("bad argument #" .. n .. "." .. nu .. " (expected string, got " .. type(sItem) .. ")", 3) | ||||
|                 local ty = type(sItem) | ||||
|                 if ty ~= "string" and ty ~= "number" then | ||||
|                     error("bad argument #" .. n .. "." .. nu .. " (expected string, got " .. ty .. ")", 3) | ||||
|                 end | ||||
|                 nMaxLen = math.max(#sItem + 1, nMaxLen) | ||||
|                 nMaxLen = math.max(#tostring(sItem) + 1, nMaxLen) | ||||
|             end | ||||
|         end | ||||
|     end | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Merith-TK
					Merith-TK