Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zaneli/lualtsv
Labeled Tab-separated Values(http://ltsv.org/) parser for Lua
https://github.com/zaneli/lualtsv
Last synced: 28 days ago
JSON representation
Labeled Tab-separated Values(http://ltsv.org/) parser for Lua
- Host: GitHub
- URL: https://github.com/zaneli/lualtsv
- Owner: zaneli
- Created: 2015-01-12T04:28:50.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2015-01-14T16:40:48.000Z (almost 10 years ago)
- Last Synced: 2023-03-31T03:57:23.787Z (almost 2 years ago)
- Language: Lua
- Size: 199 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
Awesome Lists containing this project
README
=======
lualtsv
=======Labeled Tab-separated Values(`LTSV`_) parser for Lua
.. image:: https://api.travis-ci.org/zaneli/lualtsv.png?branch=master
:target: https://travis-ci.org/zaneli/lualtsvInstallation
=======Global
-------::
$ sudo luarocks install https://raw.githubusercontent.com/zaneli/lualtsv/master/lualtsv-0.0-1.rockspec
and add "/usr/local/share/lua/5.1/?.lua" directory to LAU_PATH, if necessary.
::
$ export LUA_PATH="/usr/local/share/lua/5.1/?.lua;$LUA_PATH"
Local
-------::
$ luarocks --local install https://raw.githubusercontent.com/zaneli/lualtsv/master/lualtsv-0.0-1.rockspec
and add "$HOME/.luarocks/share/lua/5.1/?.lua" directory to LAU_PATH, if necessary.
::
$ export LUA_PATH="$HOME/.luarocks/share/lua/5.1/?.lua;$LUA_PATH"
Usage
=======load module.
::
> require("lualtsv")
parsing LTSV
-------::
> t = ltsv.parse("name:zaneli\tvalue:v1:v2:v3")
> for k, v in pairs(t) do
>> print(k .. " = " .. v)
>> end
name = zaneli
value = v1:v2:v3loading LTSV file
-------::
> ts = ltsv.load("file_path.ltsv")
> for i, t in pairs(r) do
>> for k, v in pairs(t) do
>> print("[" .. i .. "]" .. k .. " = " .. v)
>> end
>> end
[1]name = zaneli
[1]value = v1:v2:v3
[2]foo = bardumping into LTSV
-------::
> s = ltsv.dump({ name = "zaneli", value = "v1:v2:v3" })
> print(s)
name:zanelivalue:v1:v2:v3.. _`LTSV`: http://ltsv.org/