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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@l8b/time

v1.0.11

Published

**LootiScript API Binding** - System information and timing utilities.

Readme

@l8b/time

LootiScript API Binding - System information and timing utilities.

Note: This package is used as an API binding for LootiScript in the l8b engine.

API Reference

system

Global object providing system information and utilities.

System Properties

system.time

Get current time in milliseconds since epoch.

local currentTime = system.time
// Returns: 1701234567890

system.fps

Get current frames per second.

local fps = system.fps
// Returns: 60

system.cpu_load

Get CPU load (0.0 to 1.0).

local load = system.cpu_load
// Returns: 0.45

system.update_rate

Get update rate (updates per second).

local rate = system.update_rate
// Returns: 60

system.language

Get browser/system language.

local lang = system.language
// Returns: "en-US"

system.loading

Get loading progress (0 to 100).

local progress = system.loading
// Returns: 100 (when fully loaded)

// Check if still loading
if system.loading < 100 then
  // Show loading screen
end

Input Availability

system.inputs.keyboard

Check if keyboard is available.

if system.inputs.keyboard == 1 then
  // Keyboard is available
end

system.inputs.mouse

Check if mouse is available.

if system.inputs.mouse == 1 then
  // Mouse is available
end

system.inputs.touch

Check if touch is available.

if system.inputs.touch == 1 then
  // Touch screen is available
  // Show touch controls
end

system.inputs.gamepad

Check if gamepad is available.

if system.inputs.gamepad == 1 then
  // Gamepad API is available
  // Show gamepad controls
end

System Functions

system.pause()

Pause the game execution.

system.pause()

system.exit()

Exit the game (close window).

system.exit()

system.prompt()

Show a prompt dialog and get user input.

system.prompt("Enter your name:", function(result)
  Console.log("Hello " .. result)
  playerName = result
end)

Parameters:

  • text (string) - Prompt message
  • callback (function) - Called with user input

system.say()

Show an alert dialog.

system.say("Game Over!")
system.say("You won! Score: " .. score)

Parameters:

  • text (string) - Alert message

File Drop Support

system.file.dropped

Check if a file was dropped (drag and drop).

if system.file.dropped == 1 then
  // File was dropped
  // Handle file
end

JavaScript Interop

system.javascript

Object for JavaScript interoperability.

// Access JavaScript functions
system.javascript.myFunction()

// Access JavaScript objects
local value = system.javascript.myObject.property

Thread Management

system.threads

Array of active threads.

local threadCount = #system.threads
Console.log("Active threads: " .. threadCount)

Additional Flags

system.disable_autofullscreen

Disable automatic fullscreen.

system.disable_autofullscreen = 1  // Disable
system.disable_autofullscreen = 0  // Enable

system.preemptive

Enable preemptive threading.

system.preemptive = 1  // Enable
system.preemptive = 0  // Disable

Example Usage

Loading Screen

function draw()
  if system.loading < 100 then
    // Show loading screen
    screen.clear("#000")
    screen.setColor("#FFF")
    screen.drawText("Loading...", 10, 10, 16)
    
    // Draw progress bar
    local progress = system.loading / 100
    screen.fillRect(10, 30, progress * 200, 10, "#0F0")
    screen.drawRect(10, 30, 200, 10, "#FFF")
  else
    // Game is loaded, draw game
    drawGame()
  end
end

FPS Counter

function draw()
  screen.clear("#000")
  
  // Draw FPS
  screen.setColor("#FFFF00")
  screen.drawText("FPS: " .. system.fps, 10, 10, 12)
  
  // Draw game
  drawGame()
end

Input Detection

function init()
  // Detect available inputs
  if system.inputs.touch == 1 then
    Console.log("Touch controls available")
    showTouchControls = true
  end
  
  if system.inputs.gamepad == 1 then
    Console.log("Gamepad available")
    showGamepadHints = true
  end
end

User Input

function showNamePrompt()
  system.prompt("Enter your name:", function(name)
    if name ~= "" then
      playerName = name
      system.say("Welcome, " .. name .. "!")
      startGame()
    end
  end)
end

Pause Menu

local paused = false

function update()
  if keyboard.press.ESCAPE == 1 then
    if paused then
      // Resume
      paused = false
    else
      // Pause
      paused = true
      system.pause()
    end
  end
  
  if not paused then
    // Update game logic
    updateGame()
  end
end

Platform Detection

function init()
  // Check platform capabilities
  local isMobile = system.inputs.touch == 1
  local hasGamepad = system.inputs.gamepad == 1
  
  if isMobile then
    // Setup mobile controls
    setupTouchControls()
  else
    // Setup desktop controls
    setupKeyboardControls()
  end
  
  if hasGamepad then
    // Enable gamepad support
    enableGamepad()
  end
  
  // Log system info
  Console.log("Language: " .. system.language)
  Console.log("Update rate: " .. system.update_rate)
end

Time-Based Events

local startTime = 0
local eventTriggered = false

function init()
  startTime = system.time
end

function update()
  local elapsed = system.time - startTime
  
  // Trigger event after 5 seconds (5000ms)
  if elapsed > 5000 and not eventTriggered then
    system.say("5 seconds have passed!")
    eventTriggered = true
  end
end