๐Ÿ“ฆ Pack hundreds of Garry's Mod Lua files into just a handful

Overview

๐Ÿ“ฆ gluapack

gluapack is a program that can pack hundreds of Garry's Mod Lua files into just a handful.

Features

  • Quick, easy and portable - perfect for a CI/CD pipeline
  • Requires no serverside or clientside binary module
  • Speeds up server joining times
  • Minimizes the impact of your addons to the Lua file limit
  • Supports server, shared and client realms
  • 100% compatible with the file library, include and CompileFile
  • Works with relative path includes

Example

This is the result of packing 88 files!

Example

How does it work?

  1. gluapack will locate serverside, clientside and shared files in your addon, according to your configuration.

  2. gluapack will then pack the addon into three parts - serverside, clientside and shared.

  3. The clientside and shared packs will be commented out* and chunked into 64 KiB files.

  4. The gluapack loader will be injected into your addon's autorun folder.

  5. When the server/client loads/spawns in, the loader will unpack all the packed files into a virtual file system stored in garrysmod/data/gluapack/vfs/

  6. Any calls to file library, include and CompileFile will additionally use this virtual file system, therefore seamlessly "injecting" your unpacked addon into the game.

* This is done because on the client the loader reads the clientside/shared chunks from the Lua cache (garrysmod/cache/lua). Lua files do not show up in here until they are compiled. Therefore, the entire file is commented out so that compiling the file triggers no Lua errors, and adds the file to the Lua cache so that gluapack can read it.

Usage

๐Ÿ‘จโ€๐Ÿ’ป CLI

The program has a simple CLI interface which you can view the help of with:

Unix

./gluapack --help

Windows

gluapack.exe --help

๐Ÿ“ฆ Packing

  1. To pack an addon, first (optionally) create a gluapack.json file in your addon's root, and configure gluapack to your needs.

  2. Then, simply run the program with the pack command and the path to your addon's root (the folder containing lua/):

Unix

./gluapack pack "path/to/addon"

Windows

gluapack.exe pack "path/to/addon"
  1. Move lua/gluapack (the packed files) and lua/autorun/*_gluapack_*.lua (the loader file) into your "production"/packed addon. Make sure to delete any files you have packed from your addons, including entry files. They are no longer needed!

๐Ÿ“ค Unpacking

To unpack a packed addon, run the program with the unpack command and the path to the packed addon:

Unix

./gluapack unpack "path/to/packed-addon"

Windows

gluapack.exe unpack "path/to/packed-addon"

Configuration

{
    // The "unique ID" of your addon.
    // This can be any (non-empty) alphanumeric ASCII string.
    // If not specified, a hash of your packed addon will be used instead.
    "unique_id": null,

    // File patterns you want to exclude from being packed.
    "exclude": [],

    // File patterns you want to pack.
    "include_sh": [
        "**/*.sh.lua",
        "**/sh_*.lua",
    ],
    "include_cl": [
        "**/cl_*.lua",
        "**/*.cl.lua"
    ],
    "include_sv": [
        "**/sv_*.lua",
        "**/*.sv.lua"
    ],

    // Entry files - these files will be executed immediately after being unpacked.
    "entry_cl": [
        "autorun/client/*.lua",
        "vgui/*.lua",
        "skins/*.lua",
        "postprocess/*.lua"
    ],
    "entry_sh": [
        "autorun/*.lua"
    ],
    "entry_sv": [
        "autorun/server/*.lua"
    ]
}

Limitations

  • gluapack requires you to tell it what files should be sent to the client. It performs no analysis on your code to find AddCSLuaFile calls.

    • gluapack by default will include common file patterns (such as lua/**/sh_*.lua) for networked chunks. See Configuration for more information.
  • gluapack will cause the client to briefly freeze while spawning into the server to unpack files and build the virtual file system

  • gluapack requires you to specify entry file(s) (files that will be executed when the addon is unpacked).

    • gluapack by default will include common file patterns (such as lua/autorun/**.lua) as entry files. See Configuration for more information.
You might also like...
A super-lightweight Lua microservice (toy) framework.

Hive A super-lightweight microservice (toy) framework written in Rust. It uses Lua as interface to provide simple, fun developing experience and fast

A parser, compiler, and virtual machine evaluator for a minimal subset of Lua; written from scratch in Rust.

lust: Lua in Rust This project implements a parser, compiler, and virtual machine evaluator for a minimal subset of Lua. It is written from scratch in

Rust scaffold system with Lua embedded applets.
Rust scaffold system with Lua embedded applets.

brickpack-2022 Demo Powered by Github Actions CI/CD (Heroku) https://demo-1642622230.herokuapp.com/#/users Frontent Runner Rendered sample code (Lua 5

This tool converts Lua code to TS automatically, including the conversion of common standards to their TS equivalents.

lua-to-ts This tool converts Lua code to TS automatically, including the conversion of common standards to their TS equivalents. Code that fails to be

Node.js bindings to Lua

Node.js bindings to Lua

 โšก Fast Web Security Scanner written in Rust based on Lua Scripts ๐ŸŒ– ๐Ÿฆ€
โšก Fast Web Security Scanner written in Rust based on Lua Scripts ๐ŸŒ– ๐Ÿฆ€

โšก Fast Web Security Scanner written in Rust based on Lua Scripts ๐ŸŒ– ๐Ÿฆ€

Just a little game I made in a day to try out the WASM-4 fantasy console.

Dodgeball This is just a little game I made in a day to try out the WASM-4 fantasy console. Play it here. The palette is SODA-CAP by Cappuchi. License

A weekly dive into commonly used modules in the Rust ecosystem, with story flavor!

Rust Module of the Week A weekly dive into commonly used modules in the Rust ecosystem, with story flavor! Build status Release Draft The goal The goa

Inline CSS into style attributes

css-inline A crate for inlining CSS into HTML documents. It is built with Mozilla's Servo project components. When you send HTML emails, you need to u

Owner
Report Abuse: https://gluapack.com/report
null
Another cursed Garry's Mod module. This time, it adds the C preprocessor to Lua scripts

gm_cpreprocessor Another cursed Garry's Mod module. This time, it adds the C preprocessor to Lua scripts. It works by detouring RunStringEx and overri

William 6 Aug 14, 2022
Lua bytecode parser written in Rust using nom, part of metaworm's lua decompiler

luac-parser (ไธญๆ–‡) luaๅญ—่Š‚็ ่งฃๆžๅ™จ, ็›ฎๅ‰ๆ”ฏๆŒ lua51, lua53, lua54 ่ฟ™ๆ˜ฏ็›ฎๅ‰ๆ•ˆๆžœๆœ€ๅฅฝ็š„luaๅ็ผ–่ฏ‘ๅ™จ metaworm's luadec ็š„ไธ€้ƒจๅˆ† ๅฏไปฅๅŸบไบŽๆญคไปฃ็ ๅฎšๅˆถไฝ ๆ‰€้œ€็š„luaๅญ—่Š‚็ ่งฃๆžๅ™จ๏ผŒ็ผ–่ฏ‘ๆˆWASM๏ผŒ่ฎฉmetaworm's luadecๅŠ ่ฝฝไฝฟ็”จ๏ผŒๆฅๅ็ผ–

metaworm 4 Mar 16, 2023
Install `wasm-pack` by downloading the executable

wasm-pack-action Install wasm-pack by downloading the executable (much faster than cargo install wasm-pack, seconds vs minutes). Usage - uses: jetli/w

Jet Li 33 Nov 23, 2022
Lua 5.3 bindings for Rust

rust-lua53 Aims to be complete Rust bindings for Lua 5.3 and beyond. Currently, master is tracking Lua 5.3.3. Requires a Unix-like environment. On Win

J.C. Moyer 150 Dec 14, 2022
Safe Rust bindings to Lua 5.1

rust-lua Copyright 2014 Lily Ballard Description This is a set of Rust bindings to Lua 5.1. The goal is to provide a (relatively) safe interface to Lu

Lily Ballard 124 Jan 5, 2023
Zero-cost high-level lua 5.3 wrapper for Rust

td_rlua This library is a high-level binding for Lua 5.3. You don't have access to the Lua stack, all you can do is read/write variables (including ca

null 47 May 4, 2022
Rust library to interface with Lua

hlua This library is a high-level binding for Lua 5.2. You don't have access to the Lua stack, all you can do is read/write variables (including callb

Pierre Krieger 488 Dec 26, 2022
Pure Rust Lua implementation

purua Pure Rust Lua implementation Usage $ bat lua_examples/defun.lua โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ โ”‚ File: lua_examples/d

Kondo Uchio 35 Dec 28, 2021
A memory safe Lua interpreter

Hematita Da Lua Hematita Da Lua is an interpreter for the scripting language Lua, written entirely in 100% safe Rust. Hematita is the portugese word f

Daniel 149 Dec 29, 2022
A script language like Python or Lua written in Rust, with exactly the same syntax as Go's.

A script language like Python or Lua written in Rust, with exactly the same syntax as Go's.

null 1.4k Jan 1, 2023