Garry's Mod Wiki

Garry's Mod Wiki

  table debug.setfenv( table object, table env )

Description

We advise against using this. It may be changed or removed in a future update.

Sets the environment of the passed object.

Arguments

1 table object
Object to set environment of
2 table env
Environment to set

Returns

1 table
The object

Example

create a new environment and setfenv Display inside it

local newenvironment = {} function newenvironment.log( msg ) print( msg ) end local function Display() log( "yay" ) end debug.setfenv( Display , newenvironment ) Display()
Output:
yay

This site is a community mirror of the official Garry's Mod wiki.. This site is not maintained by Facepunch Studios.

Page content is automatically updated four times a day. Edits and history are not available.

Last Parsed: Loading...