npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@fundev-pro/dump-tstl

v1.0.0

Published

Debug utilities for TypeScript-to-Lua projects: pretty-print Lua tables with dump() and inspect() functions

Readme

dump-tstl

Debug utilities for TypeScript-to-Lua projects: pretty-print Lua tables with dump() and inspect() functions.

This project is a TypeScript wrapper for the excellent inspect.lua library by @kikito, adapted specifically for TypeScript-to-Lua (TSTL) projects.

Features

  • 🔍 Human-readable table inspection - Transform any Lua table into a readable format
  • 📦 TypeScript types included - Full type definitions for TypeScript development
  • 🎯 TSTL optimized - Designed to work seamlessly with TypeScript-to-Lua
  • 🪶 Lightweight - Minimal overhead, perfect for debugging

Installation

npm install @fundev-pro/dump-tstl

Usage

Basic Example

import { dump, inspect } from 'dump-tstl';

// Simple dump with depth control
const data = {
    name: 'player',
    stats: {
        health: 100,
        mana: 50,
        inventory: ['sword', 'shield', 'potion']
    }
};

print(dump(data, 2)); // Dump with depth of 2

Output:

{
  name = "player",
  stats = {
    health = 100,
    mana = 50,
    inventory = { "sword", "shield", "potion" }
  }
}

Advanced Inspection

import { inspect } from 'dump-tstl';

const complexData = {
    users: [
        { id: 1, name: 'Alice' },
        { id: 2, name: 'Bob' }
    ],
    settings: {
        theme: 'dark',
        notifications: true
    }
};

// Full control with inspect options
const result = inspect(complexData, {
    depth: 3,
    newline: '\n',
    indent: '  '
});

print(result);

Difference between dump() and inspect()

  • dump(value, depth?) - Simplified function that removes metatables and uses a default depth
    • value: Any Lua value to inspect
    • depth: Maximum depth to traverse (default: 1)
  • inspect(value, options?) - Full-featured inspection with complete control
    • Supports custom formatting options
    • Can process/filter values with custom functions
    • Shows metatables by default

API

dump<T>(value: T, depth?: number): string

Dumps a Lua value to a human-readable string, removing metatables.

Parameters:

  • value - The value to dump
  • depth - Maximum depth to traverse (default: 1)

Returns: String representation of the value

inspect<T>(value: T, options?: InspectOptions): string

Inspects a Lua value with full control over formatting.

Parameters:

  • value - The value to inspect
  • options - Optional configuration object:
    • depth?: number - Maximum depth (default: math.huge)
    • newline?: string - String for newlines (default: "\n")
    • indent?: string - String for indentation (default: " ")
    • process?: (item: any, path: any[]) => any - Custom value processor

Returns: String representation of the value

For more details about inspect options and capabilities, see the inspect.lua documentation.

Development

Prerequisites

  • Node.js 16+
  • npm or compatible package manager

Setup

# Clone the repository
git clone https://github.com/fundev-pro/dump-tstl.git
cd dump-tstl

# Install dependencies
npm install

Build

# Build the project (compiles TypeScript to Lua)
npm run build

# Clean build artifacts
npm run clean

# Rebuild from scratch
npm run rebuild

Prepare for Publishing

# Prepare distribution files
npm run prepare-dist

# Create a package tarball for testing (dry run)
npm run pack

# Publish to npm
npm run publish

The prepare-dist script:

  • Compiles TypeScript to Lua
  • Copies necessary files to dist/
  • Generates a clean package.json for publishing
  • Includes TypeScript definitions

Note: Before publishing, make sure you are logged into npm (npm login)

Code Quality

# Format code with Prettier
npm run format

# Check formatting
npm run format:check

# Lint TypeScript files
npm run lint

# Fix linting issues
npm run lint:fix

Project Structure

dump-tstl/
├── src/
│   ├── dump.ts          # Main dump function
│   ├── index.ts         # Package exports
│   ├── inspect.d.ts     # TypeScript definitions for inspect.lua
│   └── inspect.lua      # Original inspect.lua implementation
├── scripts/
│   └── prepare-dist.ts  # Build script for npm distribution
├── dist/                # Compiled output (gitignored)
└── package.json

License

ISC License - see LICENSE file for details.

This project includes inspect.lua which is licensed under the MIT License.

Credits

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Links