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

@l8b/env

v1.0.0

Published

Environment variables API for LootiScript

Readme

@l8b/env

Environment Variables API - Read-only access to environment variables from LootiScript.

Overview

The @l8b/env package provides a secure, read-only interface for accessing environment variables from LootiScript game code. Environment variables are loaded from .env files during development and build, and exposed to your game via the global env object.

Installation

This package is part of the L8B monorepo and is automatically available when using @l8b/runtime.

Usage

In LootiScript

function init()
  -- Get environment variable
  local apiKey = env.get("API_KEY")
  local apiUrl = env.get("API_URL") or "https://api.example.com"

  -- Check if variable exists
  if env.has("DEBUG") then
    print("Debug mode enabled")
  end

  -- Get all keys
  local keys = env.keys()
  for i = 1, #keys do
    print("Env var: " .. keys[i])
  end
end

Environment Files

Create .env files in your project root:

# .env
API_KEY=your-api-key-here
API_URL=https://api.example.com
DEBUG=true

For different environments:

  • .env - Default (loaded in all environments)
  • .env.local - Local overrides (gitignored)
  • .env.development - Development environment
  • .env.production - Production environment

API Reference

env.get(key: string): string | undefined

Get environment variable value by key.

Parameters:

  • key - Environment variable key (case-sensitive)

Returns:

  • Environment variable value as string, or undefined if not found

Example:

local apiKey = env.get("API_KEY")
if apiKey then
  print("API Key found: " .. apiKey)
end

env.has(key: string): boolean

Check if environment variable exists.

Parameters:

  • key - Environment variable key (case-sensitive)

Returns:

  • true if variable exists, false otherwise

Example:

if env.has("DEBUG") then
  print("Debug mode enabled")
end

env.keys(): string[]

Get all environment variable keys.

Returns:

  • Array of all available environment variable keys

Example:

local keys = env.keys()
for i = 1, #keys do
  print("Env var: " .. keys[i] .. " = " .. env.get(keys[i]))
end

Security

  • Read-only access: Environment variables can only be read, never modified from LootiScript
  • No sensitive data exposure: Only variables explicitly loaded from .env files are available
  • Case-sensitive: Keys are case-sensitive for consistency

Best Practices

  1. Never commit .env files: Add .env.local and .env.*.local to .gitignore
  2. Use .env.example: Create example file with placeholder values
  3. Prefix sensitive keys: Use prefixes like API_, SECRET_ for clarity
  4. Document required vars: List required environment variables in README

Integration

The EnvService is automatically initialized by the runtime orchestrator when environment variables are provided in RuntimeOptions. No manual setup required.

import { RuntimeOrchestrator } from "@l8b/runtime";

const runtime = new RuntimeOrchestrator({
  canvas: document.getElementById("game"),
  env: {
    API_KEY: process.env.API_KEY,
    API_URL: process.env.API_URL,
  },
});