Giter VIP home page Giter VIP logo

lua-pack's Introduction

This library is extended from lpack library on Luarocks to support Hexdecimal data too.

This is a simple Lua library for packing and unpacking binary data. The library provides two functions: pack and unpack.

pack is called as follows: pack(F,x1,x2,...), where F is a string describing how the values x1, x2, ... are to be interpreted and formatted. Each letter in the format string F consumes one of the given values. Only values of type number or string are accepted. pack returns a (binary) string containing the values packed as described in F. The letter codes understood by pack are listed in lpack.c (they are inspired by Perl's codes but are not the same). Numbers following letter codes in F indicate repetitions.

unpack is called as follows: unpack(s,F,[init]), where s is a (binary) string containing data packed as if by pack, F is a format string describing what is to be read from s, and the optional init marks where in s to begin reading the values. unpack returns one value per letter in F until F or s is exhausted (the letters codes are the same as for pack, except that numbers following ``A'` are interpreted as the number of characters to read into the string, not as repetitions).

The first value returned by unpack is the next unread position in s, which can be used as the init position in a subsequent call to unpack. This allows you to unpack values in a loop or in several steps. If the position returned by unpack is beyond the end of s, then s has been exhausted; any calls to unpack starting beyond the end of s will always return nil values.


pack library:
 pack(f,...) 		 unpack(s,f,[init]) 

lua-pack's People

Contributors

pintsized avatar shashiranjan84 avatar thibaultcha avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lua-pack's Issues

Incompatability with Lua 5.3 functions

lua_pack's modification of the string library conflicts with the lua 5.3 functions string.pack and string.unpack.
This breaks feature detection as used by some cross-lua-version compatible libraries.

Could lua_pack be modified to return its own table of functions so that it doesn't conflict?

Unable to install lua_pack v1.0.5 using git protocol

Hi, I am currently using Kong 2.2.0 in production which depends on lua_pack v1.0.5
The luarocks package for lua_pack v1.0.5 only has a rockspec and no rock (src) to install the package, so luarocks clones the repo and then installs the package.
Now the issue is that the URL("git://github.com/mashape/lua-pack") in the rockspec uses the git protocol, the support for which has been disabled from today from Github, refer this.

If anyone tries to install lua_pack v.1.0.5, they will get this error-

$ luarocks install lua_pack 1.0.5

Warning: Failed searching manifest: Failed downloading https://luarocks.org - Failed downloading https://luarocks.org/manifest-5.1 - /root/.cache/luarocks/https___luarocks.org/manifest-5.1
Warning: Failed searching manifest: Failed downloading https://raw.githubusercontent.com/rocks-moonscript-org/moonrocks-mirror/master - Failed downloading https://raw.githubusercontent.com/rocks-moonscript-org/moonrocks-mirror/master/manifest-5.1 - /root/.cache/luarocks/https___raw.githubusercontent.com_rocks-moonscript-org_moonrocks-mirror_master/manifest-5.1
Warning: falling back to curl - install luasec to get native HTTPS support
Installing http://luafr.org/moonrocks/lua_pack-1.0.5-0.rockspec
Cloning into 'lua-pack'...
fatal: remote error: 
  The unauthenticated git protocol on port 9418 is no longer supported.
Please see https://github.blog/2021-09-01-improving-git-protocol-security-github/ for more information.
Error: Failed cloning git repository.

Since lua_pack v.1.0.5 is a dependency for Kong for versions up to 2.6.0, installation for kong using luarocks will fail with the same error.

Possible Fix-

If the corresponding rock file is uploaded to luarocks, then the package can be installed using it and there would be no need to clone the git repo. This is how it is still possible to install v2.0.0 without any issues. (Since it has both a rockspec file and a rock file https://luarocks.org/modules/kong/lua_pack/2.0.0-0).

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.