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

ultra-lua

v1.2.5

Published

Easy-to-implement Lua scripting

Readme

ultra-lua allows you to add both simple and advanced Lua scripting into just about any NodeJS program. Example:

const lua = require("ultra-lua");  
lua.Execute(`
    print("Hello world!")
`);

Ultra-lua allows you to go even deeper with Includes, Predefinitions, and Responses.

As a simple example we will be making a program that allows people to write Lua code just as usual but we will also add a "ExitProgram" function that prints something to the console then exits the NodeJS app.

predef.lua

--include <exit.json> as ExitResponse  
  
function ExitProgram()  
    print(ExitResponse)  
end

This will be the Lua script that runs before the script the user has written. It's use is to store functions and variables the user could use in their script while not filling up the user's screen with hundreds of functions and variables (it also doesn't let the user to directly modify your code).

  • The --include keyword allows you to include in responses declarations (which allow your NodeJS script to know about certain events happening when the event's response declaration is printed to the console.

exit.json

{  
  "response": true,  
  "name": "Exit",  
  "data": 0  
}

This is the response declaration we just included, it's just a JSON file storing data that will be passed to our NodeJS script. The "response": true and the "name": "blah blah" parts are necessary as it tells ultra-lua not to print it out like it's a normal JSON file but instead to send it to our NodeJS script (and the name part is how we will know which response is which).

script.lua

print("Hello world!");  
ExitProgram()

Prints out "Hello world!" and calls the "ExitProgram" function we made earlier.

example.js (main)

const lua = require("ultra-lua");
const result = lua.Execute(
    lua.File(__dirname + "\\script.lua"), // The File function just reads data from a file.
    lua.File(__dirname + "\\predef.lua")  
);

const responses = lua.FindResponse(result);
for (let i = 0; i < responses.length; i++) {  
    switch(responses[i].name) {  
        case "Exit":
            console.log("Exiting..");
            process.exit(responses[i].data);
            break;
  }  
}

Now i know, that's quite a bit of code, but the main thing this is doing is loading in both of the scripts we made (loading the predefined script before our normal one) into the Execute function (which ties everything up together and runs the code). Then it tries to get a list of responses (and the Execute function returns every single thing we printed out to the console, even the hidden responses we printed to the console earlier) and it goes trough a for loop seeing if there is any response being used who has a certain name (and we only added one function and one response declaration and we named it "Exit") so when "Exit" is called it will print something to the console then it will execute process.exit passing in the "data" section from the JSON (which is 0) so the NodeJS app exits with the code of 0.