> For the complete documentation index, see [llms.txt](https://docs.luasec.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.luasec.org/protecting-your-script/runtime-variables.md).

# Runtime variables (SEC\_\*)

When a user runs your script, the loader injects a set of **`SEC_*` globals** with data about that user's key and your script. You can read them anywhere in your code because they're plain globals.

## Available variables

| Global               | Type      | Description                                                         |
| -------------------- | --------- | ------------------------------------------------------------------- |
| `SEC_ScriptName`     | `string`  | Your project's display name.                                        |
| `SEC_ScriptVersion`  | `string`  | The version string you set (e.g. `"1.0.0"`). Defaults to `"0.0.0"`. |
| `SEC_IsPremium`      | `boolean` | The key's premium/whitelist flag. Best for freemium gating.         |
| `SEC_DiscordID`      | `string`  | The Discord ID linked to the key, or `""` if none.                  |
| `SEC_ExecutionCount` | `number`  | Lifetime executions for this key (≥ 1 once it has run).             |
| `SEC_ExpiresIn`      | `number`  | Seconds until the key expires. Never expiring keys are `math.huge`. |
| `SEC_Note`           | `string`  | The seller's note on the key, or `"Not specified"`.                 |

## Example

```lua
if SEC_IsPremium then
    print("Welcome, premium user!")
    loadPremiumFeatures()
else
    print("Running in free mode. Upgrade for more.")
    loadFreeFeatures()
end
```

## Example: greet the user and show expiry

```lua
local function humanTime(seconds)
    if seconds == math.huge then return "never" end
    local days = math.floor(seconds / 86400)
    if days > 0 then return days .. " day(s)" end
    return math.floor(seconds / 3600) .. " hour(s)"
end

print(("Hi <@%s>! Running %s v%s"):format(SEC_DiscordID, SEC_ScriptName, SEC_ScriptVersion))
print("Your key expires in: " .. humanTime(SEC_ExpiresIn))
print("You've run this " .. SEC_ExecutionCount .. " times.")
```

## Example: little expiry warning

```lua
if SEC_ExpiresIn ~= math.huge and SEC_ExpiresIn < 86400 then
    warn("Info, your key expires in under a day.")
end
```

{% hint style="warning" %}
Treat these as **read only**. Reassigning `SEC_*` in your own code only changes your local copy, it doesn't affect licensing.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.luasec.org/protecting-your-script/runtime-variables.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
