luajson

package module
v0.0.0-...-5d87d7d Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2018 License: Unlicense Imports: 4 Imported by: 0

README

gopher-json GoDoc

Package json is a simple JSON encoder/decoder for gopher-lua.

License

Public domain.

Documentation

Overview

Package luajson is a simple JSON encoder/decoder for gopher-lua.

Documentation

The following functions are exposed by the library:

decode(string): Decodes a JSON string. Returns nil and an error string if
                the string could not be decoded.
encode(value):  Encodes a value into a JSON string. Returns nil and an error
                string if the value could not be encoded.

Example

Below is an example usage of the library:

import (
    luajson "github.com/davars/luajson"
)

L := lua.NewState()
luajson.Preload(s)

Index

Constants

View Source
const LibName = "cjson"

Variables

This section is empty.

Functions

func Decode

func Decode(L *lua.LState, data []byte) (lua.LValue, error)

Decode converts the JSON encoded data to Lua values.

func Encode

func Encode(value lua.LValue) ([]byte, error)

Encode returns the JSON encoding of value.

func Loader

func Loader(L *lua.LState) int

Loader is the module loader function.

func Open

func Open(L *lua.LState) int

func Preload

func Preload(L *lua.LState)

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

local json = require("json")

Types

This section is empty.

Jump to

Keyboard shortcuts

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