diff options
Diffstat (limited to 'indra/newview/scripts')
-rw-r--r-- | indra/newview/scripts/lua/util.lua | 30 |
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 |