From 6b04e869802534372c880cfcafe3f90ca688363a Mon Sep 17 00:00:00 2001 From: Kazhnuz Date: Mon, 5 Apr 2021 09:33:32 +0200 Subject: [PATCH] improvement : iterates table on table.toString --- sonic-radiance.love/core/utils/table.lua | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/sonic-radiance.love/core/utils/table.lua b/sonic-radiance.love/core/utils/table.lua index 29b1122..f7d4f14 100644 --- a/sonic-radiance.love/core/utils/table.lua +++ b/sonic-radiance.love/core/utils/table.lua @@ -36,7 +36,19 @@ end function Table.toString(table) local string = "{" for key, value in pairs(table) do - string = string .. key .. ":" .. value .. "," + string = string .. key .. ":" + if (type(value) == "table") then + string = string .. Table.toString(value) + elseif type(value) == "boolean" then + if (value) then + string = string .. "true" + else + string = string .. "false" + end + else + string = string .. value + end + string = string .. "," end return string .. "}" end