Skip to content

Commit 575c4e1

Browse files
Address PR review feedback: update help text for long-bracket support, optimize comment skipping
1 parent 5e16363 commit 575c4e1

2 files changed

Lines changed: 14 additions & 23 deletions

File tree

src/functions/private/Skip-LuaWhitespace.ps1

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,20 +38,11 @@
3838
# Valid long bracket comment opening
3939
$script:luaPos = $eqStart + $eqCount + 1
4040
$closePattern = ']' + ('=' * $eqCount) + ']'
41-
$closeLen = $closePattern.Length
42-
$foundClosingDelimiter = $false
43-
while ($script:luaPos -lt $script:luaString.Length) {
44-
if ($script:luaPos + $closeLen - 1 -lt $script:luaString.Length -and
45-
$script:luaString.Substring($script:luaPos, $closeLen) -eq $closePattern) {
46-
$script:luaPos += $closeLen
47-
$foundClosingDelimiter = $true
48-
break
49-
}
50-
$script:luaPos++
51-
}
52-
if (-not $foundClosingDelimiter) {
41+
$closingIndex = $script:luaString.IndexOf($closePattern, $script:luaPos)
42+
if ($closingIndex -lt 0) {
5343
throw 'Unterminated long-bracket comment.'
5444
}
45+
$script:luaPos = $closingIndex + $closePattern.Length
5546
} else {
5647
# Not a long bracket - treat as single-line comment
5748
while ($script:luaPos -lt $script:luaString.Length -and

src/functions/public/Lua/ConvertFrom-Lua.ps1

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,17 @@
99
sequences become arrays. Use -AsHashtable to get ordered hashtables instead.
1010
1111
Supports the following Lua to PowerShell type mappings:
12-
- Lua table (key = value) -> [PSCustomObject] or [ordered] hashtable
13-
- Lua sequence (array) -> [object[]]
14-
- Lua double-quoted string -> [string]
15-
- Lua single-quoted string -> [string]
16-
- Lua multi-line string [[ ]] -> [string]
17-
- Lua number (integer) -> [int] or [long]
18-
- Lua number (float) -> [double]
19-
- Lua boolean (true/false) -> [bool]
20-
- nil -> $null
21-
- Single-line comments (--) -> Ignored
22-
- Multi-line comments (--[[ ]]) -> Ignored
12+
- Lua table (key = value) -> [PSCustomObject] or [ordered] hashtable
13+
- Lua sequence (array) -> [object[]]
14+
- Lua double-quoted string -> [string]
15+
- Lua single-quoted string -> [string]
16+
- Lua multi-line string ([[ ]], [=[ ]=], [==[ ]==], etc.) -> [string]
17+
- Lua number (integer) -> [int] or [long]
18+
- Lua number (float) -> [double]
19+
- Lua boolean (true/false) -> [bool]
20+
- nil -> $null
21+
- Single-line comments (--) -> Ignored
22+
- Multi-line comments (--[[ ]], --[=[ ]=], --[==[ ]==], etc.) -> Ignored
2323
2424
.EXAMPLE
2525
```powershell

0 commit comments

Comments
 (0)