Documentation Index
Fetch the complete documentation index at: https://docs.leaf7.fun/llms.txt
Use this file to discover all available pages before exploring further.
L7 Script Macros
Leaf7 injects runtime macros into your script environment so you can access user-specific data like Discord IDs, execution counts, and key expiry — all without any API calls from the client.Macros are environment-scoped. They only exist during your script’s execution and are immediately wiped afterwards. Other scripts running in the same executor cannot read your macro values.
Available macros
Use these variables directly in your Lua source code — no setup required. Leaf7 detects which ones you reference and injects only those.| Macro | Type | Description |
|---|---|---|
L7_LinkedDiscordID | String | Discord ID of the user executing the script |
L7_ScriptName | String | Name of your project as set in the dashboard |
L7_ScriptVersion | String | Current version of your project (e.g. "1.2.3") |
L7_TotalExecutions | Number | How many times this user has executed the script |
L7_SecondsLeft | String / Number | Seconds until key expires, or "Lifetime" for non-expiring keys |
L7_UserNote | String | Custom note set on the key (or "FFA" for free-for-all) |
Usage example
Simply reference the macro names in your source code. No imports, no tables, no setup:Practical examples
Welcome screen with key info
Discord ID gate for premium features
Auto-expire warning
How it works (technical)
Detection: When you upload your source code, Leaf7 scans for any references to
L7_ macro names. Only referenced macros are injected — zero overhead for unused ones.Injection: On each execution, Leaf7 sets the macro values in
getgenv() before your script runs, then immediately nils them out after your script completes. This happens inside a pcall wrapper, so cleanup runs even if your script errors.Important notes
- Macros are read-only — modifying them has no effect on the server
- Macros are per-execution — values are fresh on every run
- If a user runs in FFA mode (no key),
L7_LinkedDiscordIDmay be empty andL7_UserNotewill be"FFA" L7_SecondsLeftreturns the string"Lifetime"for keys without an expiry date, and a number (seconds) for timed keys