Documentation
¶
Overview ¶
Package yaml implements yaml decode functionality for lua.
Example ¶
yaml.decode(string)
state := lua.NewState()
Preload(state)
inspect.Preload(state)
source := `
local yaml = require("yaml")
local inspect = require("inspect")
local text = [[
a:
b: 1
]]
local result, err = yaml.decode(text)
if err then error(err) end
print(inspect(result, {newline="", indent=""}))
`
if err := state.DoString(source); err != nil {
log.Fatal(err.Error())
}
Output: {a = {b = 1}}
Index ¶
- func CheckYAMLDecoder(L *lua.LState, n int) *yaml.Decoder
- func CheckYAMLEncoder(L *lua.LState, n int) *yaml.Encoder
- func Decode(L *lua.LState) int
- func Encode(L *lua.LState) int
- func LVYAMLDecoder(L *lua.LState, decoder *yaml.Decoder) lua.LValue
- func LVYAMLEncoder(L *lua.LState, encoder *yaml.Encoder) lua.LValue
- func Loader(L *lua.LState) int
- func Preload(L *lua.LState)
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckYAMLDecoder ¶ added in v0.1.6
func CheckYAMLEncoder ¶ added in v0.1.6
func Encode ¶ added in v0.1.2
Encode lua yaml.encode(any) returns (string, error)
Example ¶
state := lua.NewState()
Preload(state)
inspect.Preload(state)
source := `
local yaml = require("yaml")
local encoded, err = yaml.encode({a = {b = 1}})
if err then error(err) end
print(encoded)
`
if err := state.DoString(source); err != nil {
log.Fatal(err.Error())
}
Output: a: b: 1
func LVYAMLDecoder ¶ added in v0.1.6
func LVYAMLEncoder ¶ added in v0.1.6
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.