https://github.com/python1320/gmod_vstruct
GMod wrapper for https://github.com/ToxicFrog/vstruct
https://github.com/python1320/gmod_vstruct
Last synced: 2 months ago
JSON representation
GMod wrapper for https://github.com/ToxicFrog/vstruct
- Host: GitHub
- URL: https://github.com/python1320/gmod_vstruct
- Owner: Python1320
- Created: 2014-08-14T17:53:30.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2019-05-08T18:33:14.000Z (almost 6 years ago)
- Last Synced: 2024-12-31T02:13:29.418Z (4 months ago)
- Language: Lua
- Size: 6.84 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
GMod vstruct wrapper
================Read and write binary data easily.
Wrapped library (and documentation): https://github.com/ToxicFrog/vstructExample:
```lua
require 'vstruct' -- returns nothing in GMod
local data = 'hello world\0\1\1\1\1'
PrintTable(vstruct.read("z u4",data))
--{
-- [1] = "hello world",
-- [2] = 16843009,
--}
local data = 'hello world\0\1\1\1\1' print(vstruct.write("z u4",vstruct.read("z u4",data))==data)
--true
```how to use wrapfile:
```lua
local f=file.Open("test.dat",'rb','DATA')
assert(f)
f=vstruct.wrapfile(f)PrintTable(vstruct.read("u4u4u4",f))
f:close() -- note normal lua style
```_Contains submodules!_ Checkout with ```git clone --recursive --depth 1 https://github.com/Python1320/gmod_vstruct.git```