First file translated to lua
This commit is contained in:
parent
a370f468a4
commit
f1533bfd9c
12 changed files with 742 additions and 261 deletions
20
source/utilities.lua
Normal file
20
source/utilities.lua
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
local String = require(script.Parent.string)
|
||||
|
||||
return {
|
||||
stringEncaseCRLFWithFirstIndex = function(str, prefix, postfix, index)
|
||||
local endIndex = 1
|
||||
local returnValue = ""
|
||||
repeat
|
||||
local gotCR = string.sub(str, index - 1, index - 1) == "\r"
|
||||
returnValue ..= String.slice(str, endIndex, if gotCR then index - 2 else index - 1) .. prefix .. (if gotCR
|
||||
then "\r\n"
|
||||
else "\n") .. postfix
|
||||
endIndex = index + 1
|
||||
-- TODO: add String.indexOf and use it here
|
||||
index = string.find(string_, "\n", endIndex)
|
||||
until index == nil
|
||||
|
||||
returnValue += String.slice(str, endIndex)
|
||||
return returnValue
|
||||
end
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue