https://github.com/qwreey/vdf-lua
This is a Lua implementation of [KeyValues](https://developer.valvesoftware.com/wiki/KeyValues) from valvesoftware.
https://github.com/qwreey/vdf-lua
Last synced: 11 months ago
JSON representation
This is a Lua implementation of [KeyValues](https://developer.valvesoftware.com/wiki/KeyValues) from valvesoftware.
- Host: GitHub
- URL: https://github.com/qwreey/vdf-lua
- Owner: qwreey
- Created: 2023-09-01T16:32:53.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2024-11-12T18:12:46.000Z (over 1 year ago)
- Last Synced: 2024-11-26T19:40:27.075Z (over 1 year ago)
- Language: Lua
- Size: 12.7 KB
- Stars: 6
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# vdf.lua
This is a Lua implementation of [KeyValues](https://developer.valvesoftware.com/wiki/KeyValues) from valvesoftware.
#include and #base are not supported, this is just basic implementation. (due to lua's filesystem libs are differ for every engines)
# usages
## parse(str:string)
parsing VDF string into lua table structure
Preview:
```lua
local vdf = require("vdf")
local data = vdf.parse([[
"a"
{
"key" "value"
}
]])
print(data.a.key) -- prints 'value'
```
## stringify(data:table,indent:string?,disableNewline:boolean?)
### param1 data:table
lua table structure which should converted into VDF format
### param2 indent:string? (default: " ")
An indent-based string that is repeated based on its depth.
If you don't want to indent, provide a false
## pram3 disableNewline:boolean?
By default, stringify uses newlines, but if you don't want to, you can disable them by providing true
Preview:
```lua
local vdf = require("vdf")
local data = { item = { value = "5000", element = "true" } }
print(vdf.stringify(data))
--[[
it prints
"item"
{
"value" "5000"
"element" "true"
}
]]
```