yaml

package
v0.0.0-...-f7fb57a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 28, 2019 License: BSD-3-Clause Imports: 2 Imported by: 0

README

yaml GoDoc

Usage

local yaml = require("yaml")
local inspect = require("inspect")

-- yaml.decode()
local text = [[
a:
  b: 1
]]
local result, err = yaml.decode(text)
if err then error(err) end
print(inspect(result, {newline="", indent=""}))
-- Output:
-- {a = {b = 1}}

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

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decode

func Decode(L *lua.LState) int

Decode(): lua yaml.decode(string) returns (table, error)

func Loader

func Loader(L *lua.LState) int

Loader is the module loader function.

func Preload

func Preload(L *lua.LState)

Preload adds yaml to the given Lua state's package.preload table. After it has been preloaded, it can be loaded using require:

local yaml = require("yaml")

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL