summaryrefslogtreecommitdiff
path: root/indra/newview/scripts/lua/util.lua
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2024-03-13 14:39:43 -0400
committerNat Goodspeed <nat@lindenlab.com>2024-03-13 14:39:43 -0400
commita5f11a5f9eb0af70e580d15ed87c01530b13d98d (patch)
tree709aee5b9ffa2f940c833b5fe9f0e54cea3e3a78 /indra/newview/scripts/lua/util.lua
parentdfd47762afc757777dcdde3960a08951c45fb1ed (diff)
util.join() is unnecessary: luau provides table.concat().
Diffstat (limited to 'indra/newview/scripts/lua/util.lua')
-rw-r--r--indra/newview/scripts/lua/util.lua30
1 files changed, 0 insertions, 30 deletions
diff --git a/indra/newview/scripts/lua/util.lua b/indra/newview/scripts/lua/util.lua
index 898ddc58e3..e3af633ea7 100644
--- a/indra/newview/scripts/lua/util.lua
+++ b/indra/newview/scripts/lua/util.lua
@@ -36,34 +36,4 @@ function util.equal(t1, t2)
return util.empty(temp)
end
--- Concatentate the strings in the passed list, return the composite string.
--- For iterative string building, the theory is that building a list with
--- table.insert() and then using join() to allocate the full-size result
--- string once should be more efficient than reallocating an intermediate
--- string for every partial concatenation.
-function util.join(list, sep)
- -- This succinct implementation assumes that string.format() precomputes
- -- the required size of its output buffer before populating it. We don't
- -- know that. Moreover, this implementation predates our sep argument.
--- return string.format(string.rep('%s', #list), table.unpack(list))
-
- -- this implementation makes it explicit
- local sep = sep or ''
- local size = if util.empty(list) then 0 else -#sep
- for _, s in pairs(list) do
- size += #sep + #s
- end
- local result = buffer.create(size)
- size = 0
- for i, s in pairs(list) do
- if i > 1 then
- buffer.writestring(result, size, sep)
- size += #sep
- end
- buffer.writestring(result, size, s)
- size += #s
- end
- return buffer.tostring(result)
-end
-
return util