# FrameScript (global functions): World of Warcraft Forever API

Forever 1.60.1 (70959), Interface 16001, Lua 5.1, from Blizzard's own API documentation. Page: https://wowaddons.gg/forever-api/FrameScript

## Functions

### AddSourceLocationExclude

```lua
AddSourceLocationExclude(fileName)
```

Arguments:
- `fileName`: cstring

### canaccessallvalues

```lua
canAccessAllValues = canaccessallvalues(values)
```

Returns true if the immediate calling function has appropriate permissions to access and operate on all supplied values.

Arguments:
- `values`: LuaValueReference

Returns:
- `canAccessAllValues`: bool

### canaccesssecrets

```lua
canAccessSecrets = canaccesssecrets()
```

Returns true if the immediate calling function has appropriate permissions to access or operate on secret values.

Returns:
- `canAccessSecrets`: bool

### canaccesstable

```lua
canAccessTable = canaccesstable(table)
```

Returns true if the immediate calling function has appropriate permissions to index secret tables. This will return false if the caller cannot access the table value itself, or if access to the table contents is disallowed by taint.

Arguments:
- `table`: LuaValueReference

Returns:
- `canAccessTable`: bool

### canaccessvalue

```lua
canAccessValue = canaccessvalue(value)
```

Returns true if the immediate calling function has appropriate permissions to access and operate on a specific value.

Arguments:
- `value`: LuaValueReference

Returns:
- `canAccessValue`: bool

### CreateFrameWithOptions

```lua
frame = CreateFrameWithOptions(options)
```

Arguments:
- `options`: CreateFrameOptions

Returns:
- `frame`: SimpleFrame

### CreateFromMixins

```lua
object = CreateFromMixins(mixins)
```

Arguments:
- `mixins`: LuaValueVariant

Returns:
- `object`: LuaValueVariant

### CreateSecureDelegate

```lua
secureDelegateFunction = CreateSecureDelegate(luaFunction, [options])
```

Creates a secure delegate closure for a Lua function. The delegate invokes the original function in a protected call context with secure execution taint, and supports passing and returning values directly.

Arguments:
- `luaFunction`: LuaValueReference. The Lua function to invoke through the secure delegate.
- `options`: SecureDelegateOptions, may be nil. Optional settings controlling secure delegate behavior. If omitted, default options are used.

Returns:
- `secureDelegateFunction`: LuaValueReference. A secure delegate function that calls through to the original Lua function.

### CreateWindow

```lua
window = CreateWindow([popupStyle], [topMost])
```

Arguments:
- `popupStyle`: bool, default true
- `topMost`: bool, default false

Returns:
- `window`: SimpleWindow, may be nil

### dropsecretaccess

```lua
dropsecretaccess()
```

Removes the ability for the immediate calling function to access secret values.

### dumpobject

```lua
result = dumpobject([value])
```

Invokes the '__dump' metamethod on any value (if present), returning its result.

Arguments:
- `value`: LuaValueReference, may be nil

Returns:
- `result`: LuaValueReference, may be nil

### GetCallstackHeight

```lua
height = GetCallstackHeight()
```

Returns:
- `height`: number

### GetCurrentEventID

```lua
eventID = GetCurrentEventID()
```

Returns:
- `eventID`: number, may be nil

### GetErrorCallstackHeight

```lua
height = GetErrorCallstackHeight()
```

Returns:
- `height`: number, may be nil

### GetEventTime

```lua
totalElapsedTime, numExecutedHandlers, slowestHandlerName, slowestHandlerTime = GetEventTime(eventProfileIndex)
```

May return nothing.

Arguments:
- `eventProfileIndex`: number

Returns:
- `totalElapsedTime`: number
- `numExecutedHandlers`: number
- `slowestHandlerName`: cstring
- `slowestHandlerTime`: number

### GetForbiddenObjectTable

```lua
forbiddenTable = GetForbiddenObjectTable(object)
```

Arguments:
- `object`: FrameScriptObject

Returns:
- `forbiddenTable`: FrameScriptObject

### GetScriptBucketThrottleLimits

```lua
limits = GetScriptBucketThrottleLimits()
```

Returns:
- `limits`: ScriptBucketThrottleLimits

### GetSourceLocation

```lua
location = GetSourceLocation()
```

May return nothing.

Returns:
- `location`: string

### hasanysecretvalues

```lua
isAnyValueSecret = hasanysecretvalues(values)
```

Returns true if a supplied value is a secret value.

Arguments:
- `values`: LuaValueReference

Returns:
- `isAnyValueSecret`: bool

### issecrettable

```lua
isSecretOrContentsSecret = issecrettable(table)
```

Returns true if a supplied value is a secret table. This function will return true if the table value itself is secret, or if flags on the table are set such that accesses of the table would produce secrets.

Arguments:
- `table`: LuaValueReference

Returns:
- `isSecretOrContentsSecret`: bool

### issecretvalue

```lua
isSecret = issecretvalue(value)
```

Returns true if a supplied value is a secret value.

Arguments:
- `value`: LuaValueReference

Returns:
- `isSecret`: bool

### mapvalues

```lua
mapped = mapvalues(func, values)
```

Applies a given function over all supplied values individually, replacing the value with the result of the call.

Arguments:
- `func`: LuaValueReference
- `values`: LuaValueReference

Returns:
- `mapped`: LuaValueReference

### Mixin

```lua
outObject = Mixin(object, mixins)
```

Arguments:
- `object`: LuaValueVariant
- `mixins`: LuaValueVariant

Returns:
- `outObject`: LuaValueVariant

### RegisterEventCallback

```lua
RegisterEventCallback(eventName, callback)
```

Arguments:
- `eventName`: cstring
- `callback`: EventCallbackType

### RegisterUnitEventCallback

```lua
RegisterUnitEventCallback(eventName, callback, unit)
```

Arguments:
- `eventName`: cstring
- `callback`: EventCallbackType
- `unit`: UnitToken

### RunScript

```lua
RunScript(text)
```

Arguments:
- `text`: cstring

### scrubsecretvalues

```lua
scrubbed = scrubsecretvalues(values)
```

Returns a transformed list of values with inputs that are secret values replaced by nil values.

Arguments:
- `values`: LuaValueReference

Returns:
- `scrubbed`: LuaValueReference

### scrub

```lua
scrubbed = scrub(values)
```

Returns a transformed list of values with inputs that are either secret or are not string, number, or boolean type replaced by nil values.

Arguments:
- `values`: LuaValueReference

Returns:
- `scrubbed`: LuaValueReference

### secretunwrap

```lua
unwrapped = secretunwrap(values)
```

Unwraps all supplied secrets, converting them back to regular values.

Arguments:
- `values`: LuaValueReference

Returns:
- `unwrapped`: LuaValueReference

### secretwrap

```lua
wrapped = secretwrap(values)
```

Converts all supplied values to secret values, preventing most operations on them from occurring on tainted code paths.

Arguments:
- `values`: LuaValueReference

Returns:
- `wrapped`: LuaValueReference

### securecallmethod

```lua
results = securecallmethod(object, method, arguments)
```

Invokes a named method on an object with a secure call barrier that prevents errors or taint from function lookup and execution from propagating to the caller.

Arguments:
- `object`: LuaValueReference. The table on which to look up the named method from. Lookup of the method uses raw access and ignores any associated metatable.
- `method`: cstring. The name of a method to retrieve.
- `arguments`: LuaValueReference. Arguments to supply to the method. The initial 'object' parameter is always supplied as the first argument, followed by these values.

Returns:
- `results`: LuaValueReference. Results from the executed function. If an error occurred, this result list will be empty.

### securecopy

```lua
copy = securecopy([value], [options])
```

Securely copies a Lua value. Tables are deep-copied with recursive and shared references preserved. Copied values receive the current execution taint.

Arguments:
- `value`: LuaValueReference, may be nil. The Lua value to copy.
- `options`: SecureCopyOptions, may be nil. Optional settings controlling value copying behavior. If omitted, default secure copy options are used.

Returns:
- `copy`: LuaValueReference. The copied value. For tables, recursive and shared references within the copied graph are preserved.

### SetErrorCallstackHeight

```lua
SetErrorCallstackHeight([height])
```

Arguments:
- `height`: number, may be nil

### settablesecurity

```lua
settablesecurity(table, option)
```

Arguments:
- `table`: LuaValueVariant
- `option`: TableSecurityOption

### UnregisterEventCallback

```lua
UnregisterEventCallback(eventName, callback)
```

Arguments:
- `eventName`: cstring
- `callback`: EventCallbackType

### UnregisterUnitEventCallback

```lua
UnregisterUnitEventCallback(eventName, callback, unit)
```

Arguments:
- `eventName`: cstring
- `callback`: EventCallbackType
- `unit`: UnitToken

### debugprofilestart

```lua
debugprofilestart()
```

Starts a timer for profiling. The final time can be obtained by calling debugprofilestop.

### debugprofilestop

```lua
elapsedMilliseconds = debugprofilestop()
```

Returns the time in milliseconds since the last debugprofilestart call.

Returns:
- `elapsedMilliseconds`: number

## Tables

### Enum.TableSecurityOption (enumeration)

- `DisallowTaintedAccess` = 0
- `DisallowSecretKeys` = 1
- `SecretWrapContents` = 2

### CreateFrameOptions (structure)

- `frameType`: cstring
- `name`: cstring, may be nil
- `parent`: SimpleFrame, may be nil
- `inherits`: cstring[], may be nil
- `id`: number, may be nil
- `forbidden`: bool, default false
- `hidden`: bool, default false

### ScriptBucketThrottleLimits (structure)

- `luaScriptBucketThrottleMaxMsPerSecondNormal`: number
- `luaScriptBucketThrottleMaxMsPerSecondRestricted`: number
- `luaScriptBucketThrottleMaxMsBurstNormal`: number
- `luaScriptBucketThrottleMaxMsBurstRestricted`: number

### SecureCopyOptions (structure)

- `maxTraversalDepth`: number, default 100. Maximum table nesting depth allowed during recursive copying.
- `wrapUntrustedFunctions`: bool, default true. Wrap function values in secure closures that call through using the original function taint.
- `permitScriptObjects`: bool, default false. If true, preserve references to script objects in the copied output. By default, script objects will raise an error.

### SecureDelegateOptions (structure)

- `wrapUntrustedFunctions`: bool, default true. Wrap function arguments in secure closures that call through using the original function taint.

### EventCallbackType (callbacktype)

---
Make an addon with your AI: tell it "Read https://wowaddons.gg/agents.md, then make me a World of Warcraft Forever addon that …, try it with me in the game, and publish it."
