{"id":"regginator/luaencode","name":"luaencode","scope":"regginator","platform":"roblox","description":"Fast Table Serialization Library for Pure Luau/Lua 5.1+","version":"1.4.3","latest":"1.4.3","versions":["0.1.0","0.1.1","0.2.0","0.3.0","0.3.1","0.3.2","0.4.0","1.0.0","1.0.1","1.0.2","1.0.3","1.1.0","1.1.1","1.1.2","1.1.3","1.1.4","1.1.5","1.1.6","1.2.0","1.2.1","1.2.2","1.2.3","1.3.0","1.3.1","1.4.0","1.4.1","1.4.2","1.4.3"],"license":"MIT","licenseRating":"safe","licenseCaveats":[],"licenseVerified":true,"dependencies":{},"integrity":"a4ed50514c60384df2f9a6c60ce444d0b017c6381ed302542a41f2520fb759b5","likes":0,"downloads":0,"install":"forest install regginator/luaencode","url":"https://forest.dev/p/roblox/regginator/luaencode","files":"https://api.forest.dev/ai/package/roblox/regginator/luaencode/files","readme":"<div align=\"center\">\n    \n    <h1>LuaEncode</h1>\n    <h4>Optimal Serialization of Lua Tables in Native Luau/Lua 5.1+</h4>\n    <p>\n        \n        \n        <a href=\"https://github.com/regginator/LuaEncode/stargazers\">\n            <img src=\"https://img.shields.io/github/stars/regginator/LuaEncode?label=Stars&logo=GitHub\" alt=\"Repo Stars\">\n        </a>\n        \n        <a href=\"https://github.com/regginator/LuaEncode/fork\">\n            <img src=\"https://img.shields.io/github/forks/regginator/LuaEncode?label=Fork&logo=GitHub\" alt=\"Repo Forks\">\n        </a>\n        \n        <a href=\"https://github.com/regginator/LuaEncode/releases/latest\">\n            <img src=\"https://img.shields.io/github/v/release/regginator/LuaEncode?label=Latest%20Release\" alt=\"Latest Release\" />\n        </a>\n        \n        <a href=\"https://github.com/regginator/LuaEncode/blob/master/LICENSE.txt\">\n            <img src=\"https://img.shields.io/github/license/regginator/LuaEncode?label=License\" alt=\"License\" />\n        </a>\n        \n        <a href=\"https://github.com/regginator/LuaEncode/commits\">\n            <img src=\"https://img.shields.io/github/last-commit/regginator/LuaEncode?label=Last%20Modifed\" alt=\"Last Modified\" />\n        </a>\n        \n        <a href=\"https://wally.run/package/regginator/luaencode\">\n            <img src=\"https://img.shields.io/badge/wally.run-regginator%2Fluaencode-%23ad4646?style=flat\" alt=\"Package on wally.run\" />\n        </a>\n        \n        <br />\n        \n        \n        <a href=\"https://latte.to/invite\">\n            <img src=\"https://img.shields.io/discord/892211155303538748?color=%235865F2&label=Latte%20Softworks&logo=Discord&logoColor=%23FFFFFF\" alt=\"Latte Softworks Discord\" />\n        </a>\n        \n        <a href=\"https://twitter.com/jitlua\">\n            <img src=\"https://img.shields.io/twitter/follow/jitlua?color=1d9bf0&label=Follow%20%40jitlua&logo=Twitter&logoColor=ffffff&style=flat\" alt=\"Follow @jitlua (Twitter)\" />\n        </a>\n        \n        <a href=\"https://github.com/regginator\">\n            <img src=\"https://img.shields.io/github/followers/regginator?label=Follow%20%40regginator&logo=GitHub\" alt=\"Follow @regginator (GitHub)\" />\n        </a>\n        \n    </p>\n</div>\n\n___\n\n## About\n\nThis is a fairly simple, user-friendly utility module developers can use for **serialization** of [Luau](https://luau-lang.org)/[Lua](https://lua.org) tables/data structures. This natively supports both Luau (Vanilla *or* [Roblox](https://roblox.com)), and Lua 5.1+\n\n### Features\n\n* Full serialization and output of basic types `number`, `string`, `table`, `boolean`, and `nil` for keys/values.\n* Fast, optimized, and efficient!\n* Flexible and user-friendly API.\n* Pretty-printing and custom indentation.\n* `type()` **and** `typeof()` support for *full* custom Roblox DataType support (e.g. `Instance`, `UDim2`, `Vector3`, `DateTime`, etc..) - **See [Custom Roblox Lua DataType Coverage](#custom-roblox-lua-datatype-coverage) for more info.**\n* Secure iteration and value reading, so you can also use this with something like user-generated input and \"RemoteSpy\" scripts.\n* **Built in** duplicate/cyclic detection and [stack limit](#api).\n* Raw keys/values with [`FunctionsReturnRaw`](#api).\n\n___\n\n## Installation\n\n* ### GitHub Releases\n\n    You can download the [`LuaEncode.lua`](https://github.com/regginator/LuaEncode/releases/latest/download/LuaEncode.lua) or [`LuaEncode.rbxm`](https://github.com/regginator/LuaEncode/releases/latest/download/LuaEncode.rbxm) module for the [latest GitHub release](https://github.com/regginator/LuaEncode/releases/latest), and immediately use the module!\n\n* ### Rojo/Wally\n\n    If you're familiar with [Rojo](https://rojo.space) or [Wally](https://wally.run), you can either clone the repository and build the model yourself, or import in your `Wally.toml` as a dependency:\n\n  * As a dependency in `Wally.toml`:\n\n    ```toml\n    LuaEncode = \"regginator/luaencode@1.1.6\"\n    ```\n\n  * Rojo: (Building manually)\n\n    ```sh\n    rojo build -o LuaEncode.rbxm\n    ```\n\n* ### Git Submodule\n\n    If you're familiar with [Git Submodules](https://gist.github.com/gitaarik/8735255), you can import the repo into your project as per use case.\n\n* ### Loadstring by Release URL\n\n    If you're using a script utility with direct access to `loadstring()`, you can use the following line to import the module into your project:\n\n    ```lua\n    local LuaEncode = loadstring(game:HttpGet(\"https://github.com/regginator/LuaEncode/releases/latest/download/LuaEncode.lua\"))()\n    ```\n\n    *(Or with HttpService if using the Roblox API)*\n\n    ```lua\n    local HttpService = game:GetService(\"HttpService\")\n    local LuaEncode = loadstring(HttpService:GetAsync(\"https://github.com/regginator/LuaEncode/releases/latest/download/LuaEncode.lua\"))()\n    ```\n\n___\n\n## Basic Usage\n\n```lua\nlocal LuaEncode = require(\"src/LuaEncode\")\n\nlocal Table = {\n    foo = \"bar\",\n    baz = {\n        1,\n        \"one\",\n        true,\n        false,\n        [90] = \"ninety\",\n        [\"hi mom\"] = \"hello world\",\n    },\n    qux = function()\n        return \"\\\"hi!\\\"\"\n    end,\n}\n\nlocal Encoded = LuaEncode(Table, {\n    PrettyPrinting = true, -- `false` by default\n    IndentCount = 4, -- `0` by default\n    FunctionsReturnRaw = true, -- `false` by default\n})\n\nprint(Encoded)\n```\n\nExpected Output:\n\n```lua\n{\n    qux = \"hi!\",\n    baz = {\n        1,\n        \"one\",\n        true,\n        false,\n        [90] = \"ninety\",\n        [\"hi mom\"] = \"hello world\"\n    },\n    foo = \"bar\"\n}\n```\n\n___\n\n## API\n\n```lua\n<string> LuaEncode(<table> inputTable, <table?> options)\n```\n\n### Options\n\n| Argument           | Type                | Description                         |\n|:-------------------|:--------------------|:------------------------------------|\n| PrettyPrinting     | `<boolean?:false>`  | Whether or not the output should use [pretty printing](https://en.wikipedia.org/wiki/Prettyprint#Programming_code_formatting). |\n| IndentCount        | `<number?:0>`       | The amount of \"spaces\" that should be indented per entry. |\n| OutputWarnings     | `<boolean?:true>`   | If \"warnings\" should be placed to the output (as comments); It's recommended to keep this enabled, however this can be disabled at ease. |\n| StackLimit         | `<number?:500>`     | The limit to the stack level before recursive encoding cuts off, and stops execution. This is used to prevent stack overflow errors and such. You could use `math.huge` here if you *really* wanted. |\n| FunctionsReturnRaw | `<boolean?:false>`  | If functions in said table return back a \"raw\" value to place in the output as the key/value. |\n| UseInstancePaths   | `<boolean?:false>`  | If `Instance` reference objects should return their Lua-accessable path for encoding. If the instance is parented under `nil` or isn't under `game`/`workspace`, it'll always fall back to `Instance.new(ClassName)` as before. |\n\n___\n\n## Custom Roblox Lua DataType Coverage\n\n*(See [AllRobloxTypes.server.lua](tests/AllRobloxTypes/AllRobloxTypes.server.lua) for example input and (the current expected) output of ALL Roblox DataTypes.)*\n\n✔ Implemented | ➖ Partially Implemented | ❌ Unimplemented | ⛔ Never\n\n| DataType                                                                                                      | Serialized As                                     | Implemented |\n|:--------------------------------------------------------------------------------------------------------------|:--------------------------------------------------|:-----------:|\n| [Axes](https://create.roblox.com/docs/reference/engine/datatypes/Axes)                                        | `Axes.new()`                                      | ✔ |\n| [BrickColor](https://create.roblox.com/docs/reference/engine/datatypes/BrickColor)                            | `BrickColor.new()`                                | ✔ |\n| [CFrame](https://create.roblox.com/docs/reference/engine/datatypes/CFrame)                                    | `CFrame.new()`                                    | ✔ |\n| [CatalogSearchParams](https://create.roblox.com/docs/reference/engine/datatypes/CatalogSearchParams)          | `CatalogSearchParams.new()`                       | ✔ |\n| [Color3](https://create.roblox.com/docs/reference/engine/datatypes/Color3)                                    | `Color3.new()`                                    | ✔ |\n| [ColorSequence](https://create.roblox.com/docs/reference/engine/datatypes/ColorSequence)                      | `ColorSequence.new(<ColorSequenceKeypoints>)`     | ✔ |\n| [ColorSequenceKeypoint](https://create.roblox.com/docs/reference/engine/datatypes/ColorSequenceKeypoint)      | `ColorSequenceKeypoint.new()`                     | ✔ |\n| [DateTime](https://create.roblox.com/docs/reference/engine/datatypes/DateTime)                                | `DateTime.fromUnixTimestamp()`                    | ✔ |\n| [DockWidgetPluginGuiInfo](https://create.roblox.com/docs/reference/engine/datatypes/DockWidgetPluginGuiInfo)  | `DockWidgetPluginGuiInfo.new()`                   | ✔ |\n| [Enum](https://create.roblox.com/docs/reference/engine/datatypes/Enum)                                        | `Enum.<EnumType>`                                 | ✔ |\n| [EnumItem](https://create.roblox.com/docs/reference/engine/datatypes/EnumItem)                                | `Enum.<EnumType>.<EnumItem>`                      | ✔ |\n| [Enums](https://create.roblox.com/docs/reference/engine/datatypes/Enums)                                      | `Enum`                                            | ✔ |\n| [Faces](https://create.roblox.com/docs/reference/engine/datatypes/Faces)                                      | `Faces.new()`                                     | ✔ |\n| [FloatCurveKey](https://create.roblox.com/docs/reference/engine/datatypes/FloatCurveKey)                      | `FloatCurveKey.new()`                             | ✔ |\n| [Font](https://create.roblox.com/docs/reference/engine/datatypes/Font)                                        | `Font.new()`                                      | ✔ |\n| [Instance](https://create.roblox.com/docs/reference/engine/datatypes/Instance)                                | `Instance.new()`                                  | ✔ |\n| [NumberRange](https://create.roblox.com/docs/reference/engine/datatypes/NumberRange)                          | `NumberRange.new()`                               | ✔ |\n| [NumberSequence](https://create.roblox.com/docs/reference/engine/datatypes/NumberSequence)                    | `NumberSequence.new(<NumberSequenceKeypoints>)`   | ✔ |\n| [NumberSequenceKeypoint](https://create.roblox.com/docs/reference/engine/datatypes/NumberSequenceKeypoint)    | `NumberSequenceKeypoint.new()`                    | ✔ |\n| [OverlapParams](https://create.roblox.com/docs/reference/engine/datatypes/OverlapParams)                      | `OverlapParams.new()`                             | ✔ |\n| [PathWaypoint](https://create.roblox.com/docs/reference/engine/datatypes/PathWaypoint)                        | `PathWaypoint.new()`                              | ✔ |\n| [PhysicalProperties](https://create.roblox.com/docs/reference/engine/datatypes/PhysicalProperties)            | `PhysicalProperties.new()`                        | ✔ |\n| [RBXScriptConnection](https://create.roblox.com/docs/reference/engine/datatypes/RBXScriptConnection)          | `N/A`                                             | ⛔ |\n| [RBXScriptSignal](https://create.roblox.com/docs/reference/engine/datatypes/RBXScriptSignal)                  | `N/A`                                             | ⛔ |\n| [Random](https://create.roblox.com/docs/reference/engine/datatypes/Random)                                    | `Random.new()`                                    | ✔ |\n| [Ray](https://create.roblox.com/docs/reference/engine/datatypes/Ray#summary-constructors)                     | `Ray.new()`                                       | ✔ |\n| [RaycastParams](https://create.roblox.com/docs/reference/engine/datatypes/RaycastParams)                      | `RaycastParams.new()`                             | ✔ |\n| [RaycastResult](https://create.roblox.com/docs/reference/engine/datatypes/RaycastResult)                      | `N/A`                                             | ⛔ |\n| [Rect](https://create.roblox.com/docs/reference/engine/datatypes/Rect#summary-constructors)                   | `Rect.new()`                                      | ✔ |\n| [Region3](https://create.roblox.com/docs/reference/engine/datatypes/Region3)                                  | `Region3.new()`                                   | ✔ |\n| [Region3int16](https://create.roblox.com/docs/reference/engine/datatypes/Region3int16)                        | `Region3int16.new()`                              | ✔ |\n| [TweenInfo](https://create.roblox.com/docs/reference/engine/datatypes/TweenInfo)                              | `TweenInfo.new()`                                 | ✔ |\n| [RotationCurveKey](https://create.roblox.com/docs/reference/engine/datatypes/RotationCurveKey)                | `RotationCurveKey.new()`                          | ✔ |\n| [UDim](https://create.roblox.com/docs/reference/engine/datatypes/UDim)                                        | `UDim.new()`                                      | ✔ |\n| [UDim2](https://create.roblox.com/docs/reference/engine/datatypes/UDim2)                                      | `UDim2.new()`                                     | ✔ |\n| [Vector2](https://create.roblox.com/docs/reference/engine/datatypes/Vector2)                                  | `Vector2.new()`                                   | ✔ |\n| [Vector2int16](https://create.roblox.com/docs/reference/engine/datatypes/Vector2int16)                        | `Vector2int16.new()`                              | ✔ |\n| [Vector3](https://create.roblox.com/docs/reference/engine/datatypes/Vector3)                                  | `Vector3.new()`                                   | ✔ |\n| [Vector3int16](https://create.roblox.com/docs/reference/engine/datatypes/Vector3int16)                        | `Vector3int16.new()`                              | ✔ |\n\n*(Official Roblox DataType documentation [here](https://create.roblox.com/docs/reference/engine/datatypes))*\n\n___\n\n## License\n\n```txt\nMIT License\n\nCopyright (c) 2022 Reggie <reggie@latte.to>\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n```\n","readmeBorrowedFrom":{"version":"1.1.6","source":"wally"},"readmeTruncated":false}