VIVE - Versatile Independent Variable Encoder

VIVE is a new way to encode strings to tables and vice-versa. VIVE script is easy to learn, easy to write, and easy to read. It’s extremely flexible and forgiving to the writer, throws almost no errors, and is very accurate.

All keys and values go between brackets. Strings use quotation marks; numbers use no quotation marks; Booleans use “yes” and “no” without quotes; tables are simply included inside the brackets in their entirety.

VIVE supports key types of “string” and “number”, and value types of “string”, “number”, “boolean” and “table”.

Sample:

[lua]

local vive=require(“vive”)

– We’ll use a pre-defined string:

local myVIVEString=[[

Comments can go anywhere except for within brackets; there’s no need to even use a comment identifier!

[“GameData”] [

    [“PlayerData”] [

        [“PlayerName”] [“John”]

        [“PlayerLevel”] [3]

    ]

    [“TotalPoints”] [123]

    [“Ammo”] [500]

    [“Coins”] [50]

    [“Stars”] [110]

]

Here’s where unlocked weapon data is:

[“UnlockedWeapons”] [

    [“SuperAwesomeGun”] [yes]

    [“LaserPistol”] [yes]

    [“ExplodingCookieDough”] [no]

]

And the unlocked levels are here:

[“UnlockedLevels”] [

    [1] [yes]

    [2] [yes]

    [3] [no]

    [“bonus”] [no]

]

I’ll include a comment with brackets here - ] [ - they can be included, they simply must be escaped.

Quotation marks, newline characters, tabs, and backslashes also must be escaped:

"

\n

\t

\

]]

local newTable=vive(myVIVEString)

print(newTable.UnlockedWeapons.ExplodingCookieDough) --> false

print(newTable.GameData.Ammo) --> 500

print(newTable.GameData.PlayerData.PlayerName) --> John

print(newTable.GameData.PlayerData.PlayerLevel) --> 3

[/lua]

Code Share Page

getitfromgymbyl.png

This looks pretty cool, I was just cursing JSON the other day for not allowing comments.

This looks pretty cool, I was just cursing JSON the other day for not allowing comments.