This repository has been archived by the owner on Dec 13, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 143
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8450335
commit a1f914f
Showing
15 changed files
with
1,324 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
local Symbol = require(script.Parent.Parent.Parent.Symbol) | ||
|
||
local AnonymousFunction = Symbol.named("AnonymousFunction") | ||
|
||
return AnonymousFunction |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
local IndentedOutput = {} | ||
local IndentedOutputMetatable = { | ||
__index = IndentedOutput, | ||
} | ||
|
||
function IndentedOutput.new(indentation) | ||
indentation = indentation or 2 | ||
|
||
local output = { | ||
_level = 0, | ||
_indentation = (" "):rep(indentation), | ||
_lines = {}, | ||
} | ||
|
||
setmetatable(output, IndentedOutputMetatable) | ||
|
||
return output | ||
end | ||
|
||
function IndentedOutput:write(line, ...) | ||
if select("#", ...) > 0 then | ||
line = line:format(...) | ||
end | ||
|
||
local indentedLine = ("%s%s"):format(self._indentation:rep(self._level), line) | ||
|
||
table.insert(self._lines, indentedLine) | ||
end | ||
|
||
function IndentedOutput:push() | ||
self._level = self._level + 1 | ||
end | ||
|
||
function IndentedOutput:pop() | ||
self._level = math.max(self._level - 1, 0) | ||
end | ||
|
||
function IndentedOutput:writeAndPush(line) | ||
self:write(line) | ||
self:push() | ||
end | ||
|
||
function IndentedOutput:popAndWrite(line) | ||
self:pop() | ||
self:write(line) | ||
end | ||
|
||
function IndentedOutput:join(separator) | ||
separator = separator or "\n" | ||
|
||
return table.concat(self._lines, separator) | ||
end | ||
|
||
return IndentedOutput |
Oops, something went wrong.