luaYAML

What is it?

luaYAML is a Lua 5.1 binding for syck, a fast, spiffy YAML parser.

Installation

First, you'll need the syck library.

Once you've installed syck, download luaYAML from luaforge at http://luaforge.net/frs/?group_id=374&release_id=1027

untar the archive, edit the Makefile to match your Lua installation, run make,and make install. Pretty standard fare stuff.

Reference

yaml.load( yaml_string )
returns a table generated from yaml_string.
yaml.load_file( file_path )
returns a table generated from file at file_path.
yaml.dump( obj [, io] )
returns YAML dump of obj. If optional parameter io is given, writes the YAML dump string to the I/O stream io.
yaml.dump_file( obj, file_path )
writes YAML dump of obj to file at file_path.

Usage

luaYAML installs two modules - yaml and syck. You'll be wanting to use yaml.

an example: require"yaml" local yaml_string=[[--- - hello - 38.9 - {foo: bar, b1: b2} ]] local x = yaml.load(yaml_string) --[[ x == { "hello", 38.9, { foo="bar", b1="b2" } } ]]-- --and so on...