https://github.com/erdian718/lmodmsgpack
MessagePack for Lua.
https://github.com/erdian718/lmodmsgpack
go lua messagepack msgpack
Last synced: about 1 month ago
JSON representation
MessagePack for Lua.
- Host: GitHub
- URL: https://github.com/erdian718/lmodmsgpack
- Owner: erdian718
- License: zlib
- Created: 2019-05-19T05:46:37.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-06-08T06:11:16.000Z (about 7 years ago)
- Last Synced: 2026-01-14T20:39:19.490Z (5 months ago)
- Topics: go, lua, messagepack, msgpack
- Language: Go
- Size: 24.4 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# lmodmsgpack
MessagePack for [Lua](https://github.com/ofunc/lua).
## Usage
```go
package main
import (
"ofunc/lmodmsgpack"
"ofunc/lua/util"
)
func main() {
l := util.NewState()
l.Preload("msgpack", lmodmsgpack.Open)
util.Run(l, "main.lua")
}
```
```lua
local msgpack = require 'msgpack'
local x = msgpack.encode(v)
local y = msgpack.decode(x)
```
## Dependencies
* [ofunc/lua](https://github.com/ofunc/lua)
## Documentation
### msgpack.encode([w, ]v1[, v2, ...])
Encodes the values.
If writer `w` is provided, the encoded data will be writed to `w`.
Otherwise, the encoded data will be returned.
### msgpack.decode(x[, i])
Decodes the fisrt value.
`x` can be a reader or a string.
`i` is the start position of the string, default value is `1`.