Skip to content

Commit d101bdf

Browse files
committed
Merge pull request craigmj#10 from amrhassan/master
Cleaned up the source code tree and several implementation issues
2 parents d7e53f6 + 0f4077b commit d101bdf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+140
-1970
lines changed

CVSROOT/checkoutlist

-13
This file was deleted.

CVSROOT/commitinfo

-24
This file was deleted.

CVSROOT/config

-37
This file was deleted.

CVSROOT/cvswrappers

-19
This file was deleted.

CVSROOT/loginfo

-31
This file was deleted.

CVSROOT/modules

-26
This file was deleted.

CVSROOT/notify

-17
This file was deleted.

CVSROOT/rcsinfo

-13
This file was deleted.

CVSROOT/taginfo

-40
This file was deleted.

CVSROOT/verifymsg

-29
This file was deleted.

README.md

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# json4lua
2+
JSON and JSONRPC for Lua
3+
4+
# Installation #
5+
```
6+
luarocks install --server=http://rocks.moonscript.org/manifests/amrhassan --local json4Lua
7+
```
8+
9+
# JSON Usage #
10+
11+
## Encoding ##
12+
13+
```lua
14+
json = require('json')
15+
print(json.encode({ 1, 2, 'fred', {first='mars',second='venus',third='earth'} }))
16+
```
17+
```json
18+
[1,2,"fred", {"first":"mars","second":"venus","third","earth"}]
19+
```
20+
21+
## Decoding ##
22+
23+
```lua
24+
json = require("json")
25+
testString = [[ { "one":1 , "two":2, "primes":[2,3,5,7] } ]]
26+
decoded = json.decode(testString)
27+
table.foreach(decoded, print)
28+
print ("Primes are:")
29+
table.foreach(o.primes,print)
30+
```
31+
```
32+
one 1
33+
two 2
34+
primes table: 0032B928
35+
Primes are:
36+
1 2
37+
2 3
38+
3 5
39+
4 7
40+
```
41+
42+
# JSONRPC Usage #
43+
```lua
44+
json = require('json')
45+
require("json.rpc")
46+
server = json.rpc.proxy("http://jsolait.net/testj.py")
47+
result, error = server.echo('Test echo!')
48+
print(result)
49+
```
50+
```
51+
Test echo!
52+
```
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)