frostlang

package module
v0.0.0-...-f51e24e Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2019 License: MIT Imports: 9 Imported by: 1

README

frostlang

Provides two Go functions to convert Frostpunk .lang files to more readable JSON files, and vice versa. Reads all .lang files in a directory and writes them to JSON, or all .json files and writes to .lang.

License

MIT

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertJSONToLang

func ConvertJSONToLang(dir string, overwrite bool)

ConvertJSONToLang converts all json files in a directory to lang

func ConvertLangToJSON

func ConvertLangToJSON(dir string, overwrite bool)

ConvertLangToJSON converts all lang files in a directory to json

Types

type Node

type Node struct {
	Tag      string
	Text     string
	Children map[string]*Node
	Elements int
	Depth    int
}

Node are strucutres that should have Text or Children, but not both This allows us to store a string-based JSON object of indeterminate depth.

func NewNode

func NewNode(tag string) Node

NewNode Simple way to instantiate a Node

func (*Node) Add

func (n *Node) Add(tags [][]byte, stext string)

Add a new text to our json strucutre, by tags

func (*Node) AppendChild

func (n *Node) AppendChild(tag string) Node

AppendChild Simple way to add a child by the child's tag

func (*Node) ToJSON

func (n *Node) ToJSON() string

ToJSON turns our struct to a json string

Jump to

Keyboard shortcuts

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