Update
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
local addonname, shared = ...
|
||||
local shared = ...
|
||||
---@cast shared HeimdallShared
|
||||
---@cast addonname string
|
||||
local ModuleName = "Noter"
|
||||
|
||||
---@class Note
|
||||
@@ -12,32 +11,32 @@ local ModuleName = "Noter"
|
||||
---@diagnostic disable-next-line: missing-fields
|
||||
shared.Noter = {}
|
||||
function shared.Noter.Init()
|
||||
---Hopefully this will not be necessary
|
||||
---@param text string
|
||||
---@param size number
|
||||
---@return string[]
|
||||
local function Partition(text, size)
|
||||
local words = {}
|
||||
for word in text:gmatch("[^,]+") do
|
||||
words[#words + 1] = word
|
||||
end
|
||||
-- ---Hopefully this will not be necessary
|
||||
-- ---@param text string
|
||||
-- ---@param size number
|
||||
-- ---@return string[]
|
||||
-- local function Partition(text, size)
|
||||
-- local words = {}
|
||||
-- for word in text:gmatch("[^,]+") do
|
||||
-- words[#words + 1] = word
|
||||
-- end
|
||||
|
||||
local ret = {}
|
||||
local currentChunk = ""
|
||||
-- local ret = {}
|
||||
-- local currentChunk = ""
|
||||
|
||||
for _, word in ipairs(words) do
|
||||
if #currentChunk + #word + 1 <= size then
|
||||
currentChunk = currentChunk .. (currentChunk == "" and word or " " .. word)
|
||||
else
|
||||
if #currentChunk > 0 then ret[#ret + 1] = currentChunk end
|
||||
currentChunk = word
|
||||
end
|
||||
end
|
||||
-- for _, word in ipairs(words) do
|
||||
-- if #currentChunk + #word + 1 <= size then
|
||||
-- currentChunk = currentChunk .. (currentChunk == "" and word or " " .. word)
|
||||
-- else
|
||||
-- if #currentChunk > 0 then ret[#ret + 1] = currentChunk end
|
||||
-- currentChunk = word
|
||||
-- end
|
||||
-- end
|
||||
|
||||
if #currentChunk > 0 then ret[#ret + 1] = currentChunk end
|
||||
-- if #currentChunk > 0 then ret[#ret + 1] = currentChunk end
|
||||
|
||||
return ret
|
||||
end
|
||||
-- return ret
|
||||
-- end
|
||||
---@param array any[]
|
||||
---@return any[]
|
||||
local function Compact(array)
|
||||
|
||||
Reference in New Issue
Block a user