Giter VIP home page Giter VIP logo

rawpacker's Introduction

RawPacker

Simple binary packing/unpacking for RawArray in Godot.

About

RawPacker allows Variant arrays to be packed into and unpacked from a RawArray using a format string. The approach was inspired by Python's struct.pack and struct.unpack functions. Packing/unpacking RawArray is useful for sending and storing data in a compact form.

Installation

Simply drop the rawpacker directory in your godot/modules directory and build for the platfom of your choice.

Example

var raw_packer = RawPacker.new()
var raw_array = raw_packer.pack("?iis16fhv", [false,1,2,"fixed string",3.14,-42,"variable string"])
var array = raw_packer.unpack("?iis16fhv", raw_array)
print(array)

Output:

False, 1, 2, fixed string, 3.14, -42, variable string

Format Strings

Format Serialized Type Godot Type Size (bytes)
c char integer 1
b unsigned char integer 1
? unsigned char boolean 1
h short integer 2
H unsigned short integer 2
i int integer 4
I unsigned int integer 4
q long long integer 8
Q unsigned long long integer 8
f float real 4
d double real 8
s# char[] string #
v char[] string variable

License

Copyright (c) 2015 James McLean
Licensed under the MIT license.

rawpacker's People

Contributors

empyreanx avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.