Garry's Mod Wiki

debug.setfenv

table debug.setfenv( table object, table env )

Description

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

Page Links


Special Pages


Wikis

?

Render Time: 25ms

Session 0
DB GetPage 3
Generate Html 2
SaveChanges 12
Render Body 0
Render Sidebar 6