Skip to main content

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.

Usage example

Simply reference the macro names in your source code. No imports, no tables, no setup:
Output for a user with a 30-day key:
Output for a lifetime FFA user:

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.
Do not try to access macros from a different script or after your script has finished. They will always be nil. This is by design for security.

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_LinkedDiscordID may be empty and L7_UserNote will be "FFA"
  • L7_SecondsLeft returns the string "Lifetime" for keys without an expiry date, and a number (seconds) for timed keys