Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
8ef5a87
Add Lua conversion functions and corresponding tests
MariusStorhaug Apr 13, 2026
ec56f8e
Add ConvertTo-Lua and ConvertFrom-Lua with tests and test data
MariusStorhaug Apr 13, 2026
00ae38d
Bump PSModule/Process-PSModule/.github/workflows/workflow.yml (#1)
dependabot[bot] Apr 13, 2026
9f0a48a
Refactor Lua conversion functions and add new parsing capabilities
MariusStorhaug Apr 13, 2026
c43ada9
Fix negative value handling in Read-LuaHexFloat and Read-LuaNumber; i…
MariusStorhaug Apr 13, 2026
4fefa8d
Improve formatting in complex deep structure round-trip tests
MariusStorhaug Apr 13, 2026
e298f64
Refactor Lua conversion functions and improve error handling; update …
MariusStorhaug Apr 13, 2026
0b81aba
Add support for parsing assignment statements in ConvertFrom-Lua; enh…
MariusStorhaug Apr 13, 2026
85fe075
Format JSON files for improved readability in Assignments.json and Wo…
MariusStorhaug Apr 13, 2026
18ece06
Enhance type handling in ConvertTo-LuaTable; improve parsing logic in…
MariusStorhaug Apr 14, 2026
b24139f
Add .luacheckrc configuration to allow defined top for Lua test files
MariusStorhaug Apr 14, 2026
2cc5a98
Update .luacheckrc to ignore test data files and clarify their purpose
MariusStorhaug Apr 14, 2026
7242d0c
Enhance error handling in Read-LuaString and Read-LuaTable; validate …
MariusStorhaug Apr 14, 2026
e22dffe
Address PR review feedback
MariusStorhaug Apr 15, 2026
3cbbee6
Fix string quotation for error message in Skip-LuaWhitespace function
MariusStorhaug Apr 15, 2026
05714e5
Address PR review feedback
MariusStorhaug Apr 15, 2026
7923add
Address PR review feedback
MariusStorhaug Apr 15, 2026
58c5980
Address PR review feedback
MariusStorhaug Apr 15, 2026
3fb261f
Address PR review feedback
MariusStorhaug Apr 15, 2026
d750a9a
Address PR review feedback
MariusStorhaug Apr 15, 2026
5e16363
Address PR review feedback: throw on unexpected end of input in Read-…
MariusStorhaug Apr 15, 2026
575c4e1
Address PR review feedback: update help text for long-bracket support…
MariusStorhaug Apr 15, 2026
bb9b1a4
Address PR review feedback: use strict null assertions for nil tests
MariusStorhaug Apr 15, 2026
d380c90
Bump PSModule/Process-PSModule/.github/workflows/workflow.yml (#4)
dependabot[bot] Apr 15, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/linters/.codespellrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[codespell]
skip = ./.github/linters
ignore-words-list = afterall
ignore-words-list = afterall,simpy
4 changes: 4 additions & 0 deletions .github/linters/.luacheckrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
-- Test data files are Lua data/config files (e.g. WoW SavedVariables format)
-- that define top-level globals and are not executed as scripts.
files["**/tests/data/Assignments.lua"].ignore = {"111", "112"}
files["**/tests/data/WoWSavedVariables.lua"].ignore = {"111", "112"}
2 changes: 1 addition & 1 deletion .github/workflows/Process-PSModule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ permissions:

jobs:
Process-PSModule:
uses: PSModule/Process-PSModule/.github/workflows/workflow.yml@60bdf8a5a4c92c53fcf2a8d23f7d5f5c93e6864e # v5.4.3
uses: PSModule/Process-PSModule/.github/workflows/workflow.yml@11117919e65242d3388727819a751f74ad24ea9e # v5.5.0
secrets:
APIKEY: ${{ secrets.APIKEY }}
81 changes: 59 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,69 +1,106 @@
# {{ NAME }}
# Lua

{{ DESCRIPTION }}
A PowerShell module for converting between PowerShell objects and Lua table notation.

## Prerequisites

This uses the following external resources:

- The [PSModule framework](https://github.com/PSModule/Process-PSModule) for building, testing and publishing the module.

## Installation

To install the module from the PowerShell Gallery, you can use the following command:

```powershell
Install-PSResource -Name {{ NAME }}
Import-Module -Name {{ NAME }}
Install-PSResource -Name Lua
Import-Module -Name Lua
```

## Usage

Here is a list of example that are typical use cases for the module.
Here is a list of examples that are typical use cases for the module.

### Example 1: Convert a PowerShell hashtable to Lua

```powershell
@{ name = "ElvUI"; version = "13.74"; enabled = $true } | ConvertTo-Lua

{
name = "ElvUI",
version = "13.74",
enabled = true
}
```

### Example 2: Convert a Lua table string to a PowerShell object

```powershell
$lua = '{ name = "ElvUI", version = "13.74", enabled = true }'
$config = $lua | ConvertFrom-Lua
$config.name # ElvUI
$config.enabled # True
```

### Example 3: Read a Lua file and convert to PowerShell

### Example 1: Greet an entity
```powershell
$luaContent = Get-Content -Path 'config.lua' -Raw
$config = ConvertFrom-Lua -InputObject $luaContent
$config.unitframes.playerWidth # 270
```

Provide examples for typical commands that a user would like to do with the module.
### Example 4: Convert a PowerShell object to compressed Lua

```powershell
Greet-Entity -Name 'World'
Hello, World!
@(1, 2, 3) | ConvertTo-Lua -Compress

{1,2,3}
```

### Example 2
### Example 5: Round-trip JSON to Lua

```powershell
$data = Get-Content -Path 'settings.json' -Raw | ConvertFrom-Json
$luaOutput = $data | ConvertTo-Lua
$luaOutput | Set-Content -Path 'settings.lua'
```

Provide examples for typical commands that a user would like to do with the module.
### Example 6: Convert Lua to PSCustomObject

```powershell
Import-Module -Name PSModuleTemplate
$result = '{ server = "localhost", port = 8080 }' | ConvertFrom-Lua
$result.server # localhost
$result.port # 8080
```

### Find more examples

To find more examples of how to use the module, please refer to the [examples](examples) folder.

Alternatively, you can use the Get-Command -Module 'This module' to find more commands that are available in the module.
To find examples of each of the commands you can use Get-Help -Examples 'CommandName'.
Alternatively, you can use `Get-Command -Module 'Lua'` to find commands available in the module.
To find examples of each command, use `Get-Help -Examples 'CommandName'`.

## Documentation

Link to further documentation if available, or describe where in the repository users can find more detailed documentation about
the module's functions and features.
For detailed documentation on each function, use the built-in help system:

```powershell
Get-Help ConvertTo-Lua -Full
Get-Help ConvertFrom-Lua -Full
```

## Contributing

Coder or not, you can contribute to the project! We welcome all contributions.

### For Users
### For users

If you don't code, you still sit on valuable information that can make this project even better. If you experience that the
product does unexpected things, throw errors or is missing functionality, you can help by submitting bugs and feature requests.
Please see the issues tab on this project and submit a new issue that matches your needs.

### For Developers
### For developers

If you do code, we'd love to have your contributions. Please read the [Contribution guidelines](CONTRIBUTING.md) for more information.
You can either help by picking up an existing issue or submit a new one if you have an idea for a new feature or improvement.

## Acknowledgements

Here is a list of people and projects that helped this project in some way.
46 changes: 35 additions & 11 deletions examples/General.ps1
Original file line number Diff line number Diff line change
@@ -1,19 +1,43 @@
<#
.SYNOPSIS
This is a general example of how to use the module.
.SYNOPSIS
Examples of how to use the Lua module.
#>

# Import the module
Import-Module -Name 'PSModule'
Import-Module -Name 'Lua'

# Define the path to the font file
$FontFilePath = 'C:\Fonts\CodeNewRoman\CodeNewRomanNerdFontPropo-Regular.tff'
# Convert a PowerShell hashtable to Lua table notation
$config = [ordered]@{
name = 'ElvUI'
version = '13.74'
enabled = $true
scaling = 0.85
authors = @('Elv', 'Simpy', 'Blazeflack')
}
$luaOutput = $config | ConvertTo-Lua
Write-Output $luaOutput

# Install the font
Install-Font -Path $FontFilePath -Verbose
# Convert a Lua table string to a PowerShell object
$luaString = @'
{
name = "ElvUI",
version = "13.74",
enabled = true,
unitframes = {
playerWidth = 270,
playerHeight = 54
}
}
'@
$result = $luaString | ConvertFrom-Lua
Write-Output "Name: $($result.name)"
Write-Output "Player Width: $($result.unitframes.playerWidth)"

# List installed fonts
Get-Font -Name 'CodeNewRomanNerdFontPropo-Regular'
# Convert Lua to PSCustomObject
$obj = '{ server = "localhost", port = 8080 }' | ConvertFrom-Lua
Write-Output "Server: $($obj.server), Port: $($obj.port)"

# Compressed output
$compressed = @(1, 2, 3, 4, 5) | ConvertTo-Lua -Compress
Write-Output "Compressed: $compressed"

# Uninstall the font
Get-Font -Name 'CodeNewRomanNerdFontPropo-Regular' | Uninstall-Font -Verbose
3 changes: 0 additions & 3 deletions src/README.md

This file was deleted.

Binary file removed src/assemblies/LsonLib.dll
Binary file not shown.
15 changes: 0 additions & 15 deletions src/classes/private/SecretWriter.ps1

This file was deleted.

147 changes: 0 additions & 147 deletions src/classes/public/Book.ps1

This file was deleted.

3 changes: 0 additions & 3 deletions src/data/Config.psd1

This file was deleted.

3 changes: 0 additions & 3 deletions src/data/Settings.psd1

This file was deleted.

3 changes: 0 additions & 3 deletions src/finally.ps1

This file was deleted.

Loading
Loading