Skip to content

qwreey/vdf.lua

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 

Repository files navigation

vdf.lua

This is a Lua implementation of 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:

local vdf = require("vdf")
local data = vdf.parse([[
"a"
{
  "key" "value"
}
]])
print(data.a.key) -- prints 'value'

stringify(data:table,indent:string?,disableNewline:boolean?)

pram1 data:table

lua table structure which should converted into VDF format

pram2 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:

local vdf = require("vdf")
local data = { item = { value = "5000", element = "true" } }
print(vdf.stringify(data))
--[[
it prints

"item"
{
  "value" "5000"
  "element" "true"
}
]]

About

This is a Lua implementation of [KeyValues](https://developer.valvesoftware.com/wiki/KeyValues) from valvesoftware.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages