package.seeall

From GMod Wiki

Jump to: navigation, search
Function
Syntax package.seeall( Table module )
Where is this used?
Description:
Sets a metatable for module with its __index field referring to the global environment, so that this module inherits values from the global environment. To be used as an option to function module.
Returns: nil
Part of Library: package
Realm: NewerShared.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=Package.seeall]Package.seeall [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]


Example

DescriptionThis function is used instead of "local (global_name) = (global_name)" to use global functions and tables in modules.
Used onNewerShared.png
CodeWithout package.seeall (Source Code)
 
local vgui = vgui 
local table = table 
local pairs = pairs 
local pcall = pcall 
local ScrW = ScrW 
local ScrH = ScrH 
local Msg = Msg 
local unpack = unpack 
 
require("timer") 
local timer = timer 
 
module("vguix") 
 

With package.seeall (Source Code)

module("cookie", package.seeall)
OutputN/A


Additional Notes

See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox