Releases: chadhyatt/LuaEncode
1.4.4
1.4.3
1.4.2
1.4.0
Changes
- Add
options.InsertCyclesflag to API (See below for more info) - Use a stack-based system for table depth as opposed to costly call recursion, optimize output concatenation (~20x faster on LargeTableBenchmark)
- Fix misc. edge-case logic bugs
Manual Cycle Insert Codegen (options.InsertCycles)
By setting the InsertCycles option to true, if there are cyclic references in your table, the output will be wrapped in an anonymous function that adds codegen to manually set paths to those references on the output table. NOTE: If a key in the index path to the cycle is a reference type (e.g. table, function), the codegen can't externally set that path, and it will be ignored.
options.InsertCycles is set to false by default, as potentially wrapping the output table in an anonymous function and storing reference paths during the serialization process may not be ideal for all scenarios.
Example Input:
local Table = {
{
"Hello",
AnotherTable = {},
["This can't be indexed raw"] = {}
},
}
Table.Self = Table
Table[2] = Table[1].AnotherTable
Table["3"] = Table[1]["This can't be indexed raw"]
print(LuaEncode(Table, {
Prettify = true,
InsertCycles = true,
OutputWarnings = false, -- Silence any "warning" codeblocks
}))Output:
(function(t)
t.Self = t
t[2] = t[1].AnotherTable
t["3"] = t[1]["This can't be indexed raw"]
return t
end)({
{
"Hello",
AnotherTable = {},
["This can't be indexed raw"] = {}
},
{},
Self = {},
["3"] = {}
})1.3.1
[1.3.1]
Additions
Changes/Fixes
(@lolmanurfunny) Don't use table.clone for recursive table config 9f6b4a1
Use optimize (Luau) compiler flag comment 9f6b4a1
Make EvaluateInstancePath use a while loop instead of recursive function calls c5e78c3
(@lolmanurfunny) Use and/or cond instead of tostring() for boolean 1933fb3
1.2.2
1.2.1
1.2.0
[1.2.0]
Changes/Fixes
Options.PrettyPrintinghas been renamed to "Prettify";PrettyPrintinghas been deprecated, and will be supported in the future for compatibility. Please don't use it for current work/use.- If
Options.IndentCountis unspecified andOptions.Prettifyis true, it will automatically be set to4, as usual in expected behavior. - Multiple runtime optimizations and internal codebase improvements, large and small.
- Comment blocks are now properly escaped for any errors/warnings placed into output by default.
Options.UseInstancePathsis now set totrueby default, and instances without evaluated paths will be set tonilin output, with a comment block containing the ClassName to prevent unexpected instancing errors at runtime.- We're now using a more proper test suite with Lune, providing complete source testing utils for both Luau, Lua 5.1, and LuaJIT.
Notes
- A ton has changed internally in this release, PLEASE let me know if there's absolutely any issues with output etc.
- i sleep
1.1.6
[1.1.6]
Changes/Improvements
- Fixed strings not serializing in vanilla Lua 5.1; We can't do "\0-\31" due to an embedded zeros in pattern issue. (https://stackoverflow.com/a/22962409)
- Improve number value serialization with better accuracy and stability, fix negative-infinite numbers not serializing properly.
- Minor improvements to argument handling in custom Roblox DataTypes.
- Use
game:FindServiceforIsServicecheck when evaluating instance paths.
Notes
- This also fixes negative-infinite numbers not always correctly serializing in Maui.