Revision | 9de02a0999886b4aeb889fdef7a8f57c88846225 (tree) |
---|---|
Zeit | 2024-03-30 11:43:34 |
Autor | Fs <Fsu0413@vip....> |
Commiter | Fs |
indent dump table
@@ -1029,7 +1029,9 @@ gen.generateBuildCommand = function(self, para) | ||
1029 | 1029 | return ret |
1030 | 1030 | end |
1031 | 1031 | |
1032 | -gen.dumpConfTable = function(self, para) | |
1032 | +gen.dumpConfTable = function(self, para, indent) | |
1033 | + if not indent then indent = 1 end | |
1034 | + | |
1033 | 1035 | local returnText = "{\n" |
1034 | 1036 | local keys = {} |
1035 | 1037 |
@@ -1042,7 +1044,7 @@ gen.dumpConfTable = function(self, para) | ||
1042 | 1044 | for _, k in ipairs(keys) do |
1043 | 1045 | local v = para[k] |
1044 | 1046 | -- key is always string |
1045 | - returnText = returnText .. "[\"" .. k .. "\"] = " | |
1047 | + returnText = returnText .. string.rep("\t", indent) .. "[\"" .. k .. "\"] = " | |
1046 | 1048 | if type(v) == "nil" then |
1047 | 1049 | returnText = returnText .. "nil" |
1048 | 1050 | elseif type(v) == "string" then |
@@ -1050,13 +1052,13 @@ gen.dumpConfTable = function(self, para) | ||
1050 | 1052 | elseif type(v) == "boolean" then |
1051 | 1053 | returnText = returnText .. (v and "true" or "false") |
1052 | 1054 | elseif type(v) == "table" then |
1053 | - returnText = returnText .. self:dumpConfTable(v) | |
1055 | + returnText = returnText .. self:dumpConfTable(v, indent + 1) | |
1054 | 1056 | else |
1055 | 1057 | returnText = returnText .. tostring(v) |
1056 | 1058 | end |
1057 | 1059 | returnText = returnText .. ",\n" |
1058 | 1060 | end |
1059 | - returnText = returnText .. "}" | |
1061 | + returnText = returnText .. string.rep("\t", indent - 1) .. "}" | |
1060 | 1062 | return returnText |
1061 | 1063 | end |
1062 | 1064 |