search/
Start typing to search packages!
package_2
dotenv-luau
By @horsenuggets
Roblox
Mirroreddotenv-luau
A dotenv parser implemented in Luau.
Installation
Add to your wally.toml:
[dependencies]
Dotenv = "horsenuggets/dotenv-luau@0.1.5"
Then run:
wally install
Usage
Parsing a string
local Dotenv = require("@packages/Dotenv")
local env = Dotenv.parse([[
DATABASE_URL=postgres://localhost:5432/mydb
API_KEY="my-secret-key"
DEBUG=true
]])
print(env.DATABASE_URL) -- postgres://localhost:5432/mydb
print(env.API_KEY) -- my-secret-key
print(env.DEBUG) -- true
Loading from a file (Lune only)
local Dotenv = require("@packages/Dotenv")
-- Load from .env file and set environment variables
Dotenv.load()
-- Load from a custom path
Dotenv.load(".env.local")
Features
- Parses standard
.envfile format - Supports double-quoted and single-quoted values
- Supports multiline values with double quotes
- Handles values containing
=characters - Normalizes line endings (CRLF to LF)
Dotenv.load()function for Lune to read files and setprocess.env
API
Dotenv.parse(str: string): { [string]: string }
Parses a dotenv-formatted string and returns a table of key-value pairs.
Dotenv.load(path: string?)
Reads a .env file and sets the values in process.env. Only available when running in Lune.
path- Path to the env file (default:".env")
Package Details
Install command (Click to copy)
Version
0.1.5
License
MIT
Safe for commercial use
Automated license review — not legal advice.
