Skip to main content

GetScriptEnvironment

This function was added in DSL 1

Description

Returns the environment assigned to script or the current script.

function GetScriptEnvironment(script) --[[ ... ]] end

Parameters

  • script?: userdata|script|nil - (Optional) The script object. userdata if checked with type(script), script if checked with type2(script).

Return Values

  • environment: table - The environment assigned to the script.

Example

local someLocal = 7
someGlobal = 7

for key, value in pairs(GetScriptEnvironment()) do
print(key, value)
end

--[[ Output:
exports table: XXXXXXXX
ImportScript: function: XXXXXXXX
someGlobal 7
]]