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

@tilua-types/lua

v5.0.1

Published

The Lua 5.1 standard library as tilua types

Readme

@tilua-types/lua

The Lua 5.1 standard library as tilua types: the base library (print, pairs, pcall, string, math, table, os, coroutine, …) — all but type(): what a value is, is asked with the language's own typeof v.

Only what Lua itself defines is here. buffer, bit32, utf8, table.create, string.split and the rest of Luau's additions are in @tilua-types/roblox — Luau is Roblox's language — which depends on this package and extends it: a name declared in both keeps what this one gave it.

Install this one directly only for plain Lua 5.1. For Luau or Roblox, install @tilua-types/roblox; it brings this along.

npm i -D @tilua-types/lua
{ "types": ["lua"], "paths": {}, "sourceMap": null }

Several results

tilua has no packs: a function returns one value, and where Lua returns several, the types here say what tilua sees instead.

  • pcall, xpcall, coroutine.resume answer a result object:

    const { success, data, error } = pcall(load, "config")
    if (success) { use(data) } else { warn(error) }

    data is what the function returned.

  • Arrays where Lua answers several: string.find is [number, number, ...string[]] | nil (the positions, then the captures), math.modf is [number, number], next is [key, value] | nil. Take them apart with const [a, b] = ....

  • One value where JavaScript would answer one: string.gsub is the new string (Lua's count of replacements is left behind), string.byte(s, i) one code — string.byte(s, i, j) an array of them — and string.match the captures as an array, or nil.

  • Loops walk arrays like everything else: pairs(t) and ipairs(t) answer an iteration whose steps are one [key, value] each, and s:gmatch(p) an iterator function answering one match's captures.

    for (const [key, score] in pairs(scores)) { print(key, score) }
    for (const [word] in text:gmatch("%a+")) { print(word) }

None of these is Lua's own function. This package puts its own in place of each global (runtime/result.luau, through lowering.mjs), for a call and for the global read as a value alike, so what runs answers what the type says.

Methods of strings, arrays and tables

text:trim(), names:filter(f) and point:keys() are not this package's. Strings, arrays and tables are tilua's own, so their metatables are declared by the language (in @tilua/parser) and run by the compiler, with or without a type library. A library adds to one with declare metatable of the same target; @tilua-types/roblox gives a string Luau's split that way.

The console and error

console:log, console:warn, console:error and error name the place that called them, the way a browser console does. The compiler writes the call site into each call. The place is the file relative to the project, without .tilua, and its line:

print("결과물")                  -- 결과물  (untouched)
console:warn("careful")         -- [Modules/ABLModule:2]: careful
const double = (x: number) => x * 2
console:log({ a: 1 }, double)   -- [Modules/ABLModule:4]: {
                                --   a = 1
                                -- } (x: number) => number  (x: number) => x * 2
error("negative", 2)            -- raised as "Modules/ABLModule.tilua:<caller's line>: negative"
  • print(x) and warn(x) are left as written. Use console:log and console:warn for output that says where it came from.
  • console:log expands a table instead of printing its address. A function prints as its inferred type and the code it was written as. It is handled by runtime/console.luau, as are console:warn and console:error.
  • console:error reports with a traceback in the project's files, on another thread, so logging a problem never stops the code that logged it.
  • error still raises, so pcall still catches it. The message starts with the place instead of a bundle line, as Lua positions an error. Level 2 and higher are read from the stack. A message that is not a string, or level 0, is raised unchanged, as in Lua.
  • error read as a value (const raise = error) finds its place on the stack.