This project makes use of [Luacheck] for catching common mistakes. Install it and configure it for your text editor.
We recommend [Atom] for editing Lua code along with the following packages:
- [linter-luacheck]: [Luacheck] integration
| #!/usr/bin/env bash | |
| #set -e | |
| PACKAGE=$1 | |
| if [ -z "$PACKAGE" ]; then | |
| echo "You must pass a .apk as input!" | |
| exit 1 | |
| fi |
| local ffi = package.preload.ffi() | |
| if(ffi.os == "Windows") then | |
| -- definitions | |
| ffi.cdef([[ | |
| typedef unsigned int LONG; | |
| typedef long long LONG_PTR; | |
| typedef void* PVOID; | |
| typedef PVOID HANDLE; |
| -- Most of this came from the blog article here: | |
| -- https://lettier.github.io/posts/2016-04-26-lets-make-a-ntp-client-in-c.html | |
| -- For reference, the packet structure looks like: | |
| --[[ | |
| typedef struct | |
| { | |
| unsigned li : 2; // Only two bits. Leap indicator. | |
| unsigned vn : 3; // Only three bits. Version number of the protocol. | |
| unsigned mode : 3; // Only three bits. Mode. Client will pick mode 3 for client. |
| -- Usage: | |
| -- filter = require 'filter' | |
| -- command = filter.lower.trim:split(' ') | |
| -- command(input) --> input:lower():trim():split(' ') | |
| -- command(input2) --> input2:lower():trim():split(' ') | |
| local unpack = unpack or table.unpack | |
| local function makeFilter(func, parent_f, parent, method_name) | |
| return setmetatable({}, { |
| // "License": Public Domain | |
| // I, Mathias Panzenböck, place this file hereby into the public domain. Use it at your own risk for whatever you like. | |
| // In case there are jurisdictions that don't support putting things in the public domain you can also consider it to | |
| // be "dual licensed" under the BSD, MIT and Apache licenses, if you want to. This code is trivial anyway. Consider it | |
| // an example on how to get the endian conversion functions on different platforms. | |
| #ifndef PORTABLE_ENDIAN_H__ | |
| #define PORTABLE_ENDIAN_H__ | |
| #if (defined(_WIN16) || defined(_WIN32) || defined(_WIN64)) && !defined(__WINDOWS__) |
| --[[ | |
| ProFi v1.3, by Luke Perkin 2012. MIT Licence http://www.opensource.org/licenses/mit-license.php. | |
| Example: | |
| ProFi = require 'ProFi' | |
| ProFi:start() | |
| some_function() | |
| another_function() | |
| coroutine.resume( some_coroutine ) | |
| ProFi:stop() |