gmod_src: Disabled Lua's debug library

Revision 595
Disabled Lua’s debug libraryChanged Files:
[ul]
[li]trunk/src_garrysmod/public/Lua/ldblib.c[/li][/ul]
Committed By Garry Newman

What? If that’s what I think you just disabled, Why the hell?

His attempt to stop “hacks”

Big mistake.

Err, not really. You shouldn’t be making addons that are dependent on a debug system.

Ok, I’ll just verify that a call to a function’s coming from a file it should be with default functions.

Any chance we could get debug.traceback left in? It’s really nice for error messages…

We needed to use the debug libary to access parts of the game garry won’t give us access to.

Or he could just leave the library as it was?

FlapJack mad. His hacks won’t work :downs:

They will, but now I need to do a fucktonne of work for the next GMod update.

Garry broke some hacks? Awww. :v:

And my anticheat. And addonisimo, mount2

Sounds like some stuff was coded using hacky, unreliable methods, and in the next update it will all break because of that.

:wtc:

How are we supposed to do anything without the debug library? Most of my stuff relies on it, and 100% of my hacks doesnt

Why do you need it, make a case.

Please do explain what’s so unreliable with this.

[lua]if SERVER then return end

require(“filex”)
require(“hook”)
require(“concommand”)
require(“timer”)

local M = hook._M
hook = nil

local dinfo = debug.getinfo
local RCC = RunConsoleCommand

CreateConVar(“fac_debug” , 0 , true , true)

for k , v in pairs(debug) do
debug[k] = function() end
end

local function stringRandom(num)
local ret = “”

for i = 1 , num do
	ret = ret .. string.char(math.random(65 , 116))
end
return ret

end

local function debugMsg(…)
if GetConVar(“fac_debug”):GetInt() == 1 then
return MsgN(…)
end
end

local hooktable = {}

local addlist = {
{n=“CheckTimers”,t=“Think”,p=“lua\includes\modules\ imer.lua”},
{n=“CheckSchedules”,t=“Think”,p=“lua\includes\modules\schedule.lua”},
{n=“BuildUndoUI”,t=“PostReloadToolsMenu”,p=“lua\includes\modules\undo.lua”},
{n=“BuildCleanupUI”,t=“PostReloadToolsMenu”,p=“lua\includes\modules\cleanup.lua”},
{n=“HTTPThink”,t=“Think”,p=“lua\includes\modules\http.lua”},
{n=“DatastreamTick”,t=“Tick”,p=“lua\includes\modules\datastream.lua”},
{n=“SharedTableTick”,t=“Tick”,p=“lua\includes\modules\datastream.lua”},
{n=“VGUIShowLayoutPaint”,t=“PostRenderVGUI”,p=“lua\includes\util\vgui_showlayout.lua”},
{n=“VGUIShowLayout”,t=“VGUIPerformLayout”,p=“lua\includes\util\vgui_showlayout.lua”},
{n=“RealFrameTime”,t=“Think”,p=“lua\includes\util\client.lua”},
{n=“DoDieFunction”,t=“EntityRemoved”,p=“lua\includes\extensions\entity.lua”},
{n=“SendQueuedConsoleCommands”,t=“Tick”,p=“lua\includes\extensions\player.lua”},
{n=“PlayerOptionInput”,t=“PlayerBindPress”,p=“lua\includes\extensions\player_cl.lua”},
{n=“PlayerOptionDraw”,t=“HUDPaint”,p=“lua\includes\extensions\player_cl.lua”},
{n=“DermaDetectMenuFocus”,t=“VGUIMousePressed”,p=“lua\derma\derma_menus.lua”},
{n=“CreateVoiceVGUI”,t=“InitPostEntity”,p=“gamemodes\base\gamemode\cl_voice.lua”},
{n=“PopulateOptionMenus”,t=“PopulateToolMenu”,p=“lua\autorun\options_menu.lua”},
{n=“CreateOptionsCategories”,t=“AddToolMenuCategories”,p=“lua\autorun\options_menu.lua”},
{n=“PopulateUtilityMenus”,t=“PopulateToolMenu”,p=“lua\autorun\utilities_menu.lua”},
{n=“CreateUtilitiesCategories”,t=“AddToolMenuCategories”,p=“lua\autorun\utilities_menu.lua”},
{n=“Stream.Init”,t=“InitPostEntity”,p=“autorun\client\cl_youstream.lua”},
{n=“Stream.Shutdown”,t=“ShutDown”,p=“autorun\client\cl_youstream.lua”},
{n=“Stream.Think”,t=“Think”,p=“autorun\client\cl_youstream.lua”},
{n=“Stream.HUDPaint”,t=“HUDPaint”,p=“autorun\client\cl_youstream.lua”},
{n=“Stream.OnPlayerChat”,t=“OnPlayerChat”,p=“autorun\client\cl_youstream.lua”},
{n=“Stream.StartChat”,t=“StartChat”,p=“autorun\client\cl_youstream.lua”},
{n=“Stream.EndChat”,t=“EndChat”,p=“autorun\client\cl_youstream.lua”},
{n=“Stream.ChatTextChanged”,t=“ChatTextChanged”,p=“autorun\client\cl_youstream.lua”},
{n=“CatBurnsYou”,t=“HUDPaint”,p=“autorun\client\radioclient.lua”},
{n=“Hookings”,t=“OnPlayerChat”,p=“autorun\client\radioclient.lua”},
{n=“RenderBloom”,t=“RenderScreenspaceEffects”,p=“lua\postprocess\bloom.lua”},
{n=“AddPostProcessMenu_Bloom”,t=“PopulateToolMenu”,p=“lua\postprocess\bloom.lua”},
{n=“CreatePostProcessingMenuCategories”,t=“AddToolMenuCategories”,p=“lua\postprocess\categories.lua”},
{n=“RenderColorModify”,t=“RenderScreenspaceEffects”,p=“lua\postprocess\color_modify.lua”},
{n=“AddPostProcessMenu_ColorMod”,t=“PopulateToolMenu”,p=“lua\postprocess\color_modify.lua”},
{n=“DOFThink”,t=“Think”,p=“lua\postprocess\dof.lua”},
{n=“AddPostProcessMenu_DoF”,t=“PopulateToolMenu”,p=“lua\postprocess\dof.lua”},
{n=“DrawMorph”,t=“RenderScreenspaceEffects”,p=“lua\postprocess\morph.lua”},
{n=“MorphMouseDown”,t=“GUIMousePressed”,p=“lua\postprocess\morph.lua”},
{n=“MorphMouseUp”,t=“GUIMouseReleased”,p=“lua\postprocess\morph.lua”},
{n=“AddPostProcessMenu_Morph”,t=“PopulateToolMenu”,p=“lua\postprocess\morph.lua”},
{n=“RenderMotionBlur”,t=“RenderScreenspaceEffects”,p=“lua\postprocess\motion_blur.lua”},
{n=“AddPostProcessMenu_MotionBlur”,t=“PopulateToolMenu”,p=“lua\postprocess\motion_blur.lua”},
{n=“RenderMaterialOverlay”,t=“RenderScreenspaceEffects”,p=“lua\postprocess\overlay.lua”},
{n=“AddPostProcessMenu_Overlay”,t=“PopulateToolMenu”,p=“lua\postprocess\overlay.lua”},
{n=“RenderSharpen”,t=“RenderScreenspaceEffects”,p=“lua\postprocess\sharpen.lua”},
{n=“AddPostProcessMenu_Sharpen”,t=“PopulateToolMenu”,p=“lua\postprocess\sharpen.lua”},
{n=“RenderSobel”,t=“RenderScreenspaceEffects”,p=“lua\postprocess\sobel.lua”},
{n=“AddPostProcessMenu_Sobel”,t=“PopulateToolMenu”,p=“lua\postprocess\sobel.lua”},
{n=“RenderStereoscopy”,t=“RenderScene”,p=“lua\postprocess\stereoscopy.lua”},
{n=“RenderSunbeams”,t=“RenderScreenspaceEffects”,p=“lua\postprocess\sunbeams.lua”},
{n=“AddPostProcessMenu_SunBeams”,t=“PopulateToolMenu”,p=“lua\postprocess\sunbeams.lua”},
{n=“RenderSuperDoF”,t=“RenderScene”,p=“lua\postprocess\super_dof.lua”},
{n=“SuperDOFMouseDown”,t=“GUIMousePressed”,p=“lua\postprocess\super_dof.lua”},
{n=“SuperDOFMouseUp”,t=“GUIMouseReleased”,p=“lua\postprocess\super_dof.lua”},
{n=“AddPostProcessMenu_SuperDoF”,t=“PopulateToolMenu”,p=“lua\postprocess\super_dof.lua”},
{n=“TextEntryLoseFocus”,t=“VGUIMousePressed”,p=“lua\vgui\dtextentry.lua”},
{n=“CreateSpawnMenu”,t=“OnGamemodeLoaded”,p=“gamemodes\sandbox\gamemode\spawnmenu\spawnmenu.lua”},
{n=“SpawnMenuKeyboardFocusOn”,t=“OnTextEntryGetFocus”,p=“gamemodes\sandbox\gamemode\spawnmenu\spawnmenu.lua”},
{n=“SpawnMenuKeyboardFocusOff”,t=“OnTextEntryLoseFocus”,p=“gamemodes\sandbox\gamemode\spawnmenu\spawnmenu.lua”},
{n=“SpawnMenuOpenGUIMousePressed”,t=“GUIMousePressed”,p=“gamemodes\sandbox\gamemode\spawnmenu\spawnmenu.lua”},
{n=“SpawnMenuOpenGUIMouseReleased”,t=“GUIMouseReleased”,p=“gamemodes\sandbox\gamemode\spawnmenu\spawnmenu.lua”},
{n=“QuickToolInit”,t=“Initialize”,p=“gamemodes\sandbox\gamemode\cl_quicktool.lua”},
{n=“QuickToolIn”,t=“OnContextMenuOpen”,p=“gamemodes\sandbox\gamemode\cl_quicktool.lua”},
{n=“QuickToolIn”,t=“OnSpawnMenuOpen”,p=“gamemodes\sandbox\gamemode\cl_quicktool.lua”},
{n=“QuickToolOut”,t=“OnContextMenuClose”,p=“gamemodes\sandbox\gamemode\cl_quicktool.lua”},
{n=“QuickToolOut”,t=“OnSpawnMenuClose”,p=“gamemodes\sandbox\gamemode\cl_quicktool.lua”},
{n=“AddFingersHook”,t=“OnEntityCreated”,p=“gamemodes\sandbox\entities\weapons\gmod_tool\stools\finger.lua”},
{n=“AddInflateHook”,t=“OnEntityCreated”,p=“gamemodes\sandbox\entities\weapons\gmod_tool\stools\inflator.lua”},
{n=“DrawRTTexture”,t=“HUDPaint”,p=“gamemodes\sandbox\entities\weapons\gmod_tool\stools\rtcamera.lua”},
{n=“AddSToolsToMenu”,t=“PopulateToolMenu”,p=“gamemodes\sandbox\entities\weapons\gmod_tool\stool.lua”},

}

local function isHookWhitelisted(type , name , path)
for k , v in pairs(addlist) do
if v.t == type and v.n == name and v.p == path then
return true
end
end

return false

end

M.GetTable()[“InitPostEntity”] = M.GetTable()[“InitPostEntity”] or {}

local ind = stringRandom(10)
local cmdqueue = {}

local function queueCommand(cmd , args)
if LocalPlayer and not LocalPlayer():IsValid() then
table.insert(cmdqueue , {c=cmd,a=args})
else
RCC(cmd , unpack(args))
end
end

M.GetTable()[“InitPostEntity”][ind] = function()
for k , v in pairs(cmdqueue) do
RCC(v.c , unpack(v.a))
end
M.GetTable()[“InitPostEntity”][ind] = nil
end

M.GetTable()[“Think”] = M.GetTable()[“Think”] or {}

local rand = stringRandom(10)
local lastvarcheck = 30
M.GetTable()[“Think”][rand] = function()
if CurTime() - 10 > lastvarcheck then
queueCommand("_ac_var" , {“sv_scriptenforcer” , GetConVarNumber(“sv_scriptenforcer”)})
queueCommand("_ac_var" , {“sv_cheats” , GetConVarNumber(“sv_cheats”)})
queueCommand("_ac_var" , {“host_timescale” , GetConVarNumber(“host_timescale”)})

	lastvarcheck = CurTime()
end

end

local function hookAdd(type , name , func)
local cpath = dinfo(2).short_src
local cpath2 = cpath:gsub("\" , “\\”)

if isHookWhitelisted(type , name , cpath) then
	if not hooktable[type] then
		hooktable[type] = {}
	end
	hooktable[type][name] = func
	M.GetTable()[type] = M.GetTable()[type] or {}
	M.GetTable()[type][name] = func
else
	queueCommand("_ac_logblock" , {string.format('{n="%s",t="%s",p="%s"},

’ , name , type , cpath2)})
debugMsg(string.format(“hook.Add(’%s’ , %s , func) rejected.” , type , name))
end
end

local function hookGetTable()
return table.Copy(hooktable)
end

local cmdlist = {

{c=“lua_cookieclear”,p=“lua\includes\modules\cookie.lua”},
{c=“lua_cookiespew”,p=“lua\includes\modules\cookie.lua”},
{c=“derma_controls”,p=“lua\derma\derma_example.lua”},
{c="+menu",p=“gamemodes\base\gamemode\cl_spawnmenu.lua”},
{c="-menu",p=“gamemodes\base\gamemode\cl_spawnmenu.lua”},
{c="+menu_context",p=“gamemodes\base\gamemode\cl_spawnmenu.lua”},
{c="-menu_context",p=“gamemodes\base\gamemode\cl_spawnmenu.lua”},
{c=“lua_find_cl”,p=“lua\autorun\developer_functions.lua”},
{c=“ent_printinfo”,p=“lua\autorun\developer_functions.lua”},
{c=“pp_morph_open”,p=“lua\postprocess\morph.lua”},
{c=“pp_superdof”,p=“lua\postprocess\super_dof.lua”},
{c=“spawnmenu_reload”,p=“gamemodes\sandbox\gamemode\spawnmenu\spawnmenu.lua”},
{c=“rtcamera_window”,p=“gamemodes\sandbox\entities\weapons\gmod_tool\stools\rtcamera.lua”},
{c=“tool_axis”,p=“gamemodes\sandbox\gamemode\spawnmenu\ oolpanel.lua”},
{c=“tool_ballsocket”,p=“gamemodes\sandbox\gamemode\spawnmenu\ oolpanel.lua”},
{c=“tool_ballsocket_adv”,p=“gamemodes\sandbox\gamemode\spawnmenu\ oolpanel.lua”},
{c=“tool_ballsocket_ez”,p=“gamemodes\sandbox\gamemode\spawnmenu\ oolpanel.lua”},
{c=“tool_elastic”,p=“gamemodes\sandbox\gamemode\spawnmenu\ oolpanel.lua”},
{c=“tool_hydraulic”,p=“gamemodes\sandbox\gamemode\spawnmenu\ oolpanel.lua”},
{c=“tool_motor”,p=“gamemodes\sandbox\gamemode\spawnmenu\ oolpanel.lua”},
{c=“tool_muscle”,p=“gamemodes\sandbox\gamemode\spawnmenu\ oolpanel.lua”},
{c=“tool_nail”,p=“gamemodes\sandbox\gamemode\spawnmenu\ oolpanel.lua”},
{c=“tool_pulley”,p=“gamemodes\sandbox\gamemode\spawnmenu\ oolpanel.lua”},
{c=“tool_rope”,p=“gamemodes\sandbox\gamemode\spawnmenu\ oolpanel.lua”},
{c=“tool_slider”,p=“gamemodes\sandbox\gamemode\spawnmenu\ oolpanel.lua”},
{c=“tool_weld”,p=“gamemodes\sandbox\gamemode\spawnmenu\ oolpanel.lua”},
{c=“tool_weld_ez”,p=“gamemodes\sandbox\gamemode\spawnmenu\ oolpanel.lua”},
{c=“tool_winch”,p=“gamemodes\sandbox\gamemode\spawnmenu\ oolpanel.lua”},
{c=“tool_balloon”,p=“gamemodes\sandbox\gamemode\spawnmenu\ oolpanel.lua”},
{c=“tool_button”,p=“gamemodes\sandbox\gamemode\spawnmenu\ oolpanel.lua”},
{c=“tool_duplicator”,p=“gamemodes\sandbox\gamemode\spawnmenu\ oolpanel.lua”},
{c=“tool_dynamite”,p=“gamemodes\sandbox\gamemode\spawnmenu\ oolpanel.lua”},
{c=“tool_emitter”,p=“gamemodes\sandbox\gamemode\spawnmenu\ oolpanel.lua”},
{c=“tool_hoverball”,p=“gamemodes\sandbox\gamemode\spawnmenu\ oolpanel.lua”},
{c=“tool_ignite”,p=“gamemodes\sandbox\gamemode\spawnmenu\ oolpanel.lua”},
{c=“tool_keepupright”,p=“gamemodes\sandbox\gamemode\spawnmenu\ oolpanel.lua”},
{c=“tool_lamp”,p=“gamemodes\sandbox\gamemode\spawnmenu\ oolpanel.lua”},
{c=“tool_light”,p=“gamemodes\sandbox\gamemode\spawnmenu\ oolpanel.lua”},
{c=“tool_magnetise”,p=“gamemodes\sandbox\gamemode\spawnmenu\ oolpanel.lua”},
{c=“tool_nocollide”,p=“gamemodes\sandbox\gamemode\spawnmenu\ oolpanel.lua”},
{c=“tool_physprop”,p=“gamemodes\sandbox\gamemode\spawnmenu\ oolpanel.lua”},
{c=“tool_spawner”,p=“gamemodes\sandbox\gamemode\spawnmenu\ oolpanel.lua”},
{c=“tool_remover”,p=“gamemodes\sandbox\gamemode\spawnmenu\ oolpanel.lua”},
{c=“tool_thruster”,p=“gamemodes\sandbox\gamemode\spawnmenu\ oolpanel.lua”},
{c=“tool_turret”,p=“gamemodes\sandbox\gamemode\spawnmenu\ oolpanel.lua”},
{c=“tool_wheel”,p=“gamemodes\sandbox\gamemode\spawnmenu\ oolpanel.lua”},
{c=“tool_eyeposer”,p=“gamemodes\sandbox\gamemode\spawnmenu\ oolpanel.lua”},
{c=“tool_faceposer”,p=“gamemodes\sandbox\gamemode\spawnmenu\ oolpanel.lua”},
{c=“tool_finger”,p=“gamemodes\sandbox\gamemode\spawnmenu\ oolpanel.lua”},
{c=“tool_inflator”,p=“gamemodes\sandbox\gamemode\spawnmenu\ oolpanel.lua”},
{c=“tool_statue”,p=“gamemodes\sandbox\gamemode\spawnmenu\ oolpanel.lua”},
{c=“tool_camera”,p=“gamemodes\sandbox\gamemode\spawnmenu\ oolpanel.lua”},
{c=“tool_colour”,p=“gamemodes\sandbox\gamemode\spawnmenu\ oolpanel.lua”},
{c=“tool_material”,p=“gamemodes\sandbox\gamemode\spawnmenu\ oolpanel.lua”},
{c=“tool_paint”,p=“gamemodes\sandbox\gamemode\spawnmenu\ oolpanel.lua”},
{c=“tool_rtcamera”,p=“gamemodes\sandbox\gamemode\spawnmenu\ oolpanel.lua”},
{c=“tool_trails”,p=“gamemodes\sandbox\gamemode\spawnmenu\ oolpanel.lua”},
{c=“tool_MotionBlur”,p=“gamemodes\sandbox\gamemode\spawnmenu\ oolpanel.lua”},
{c=“tool_Overlay”,p=“gamemodes\sandbox\gamemode\spawnmenu\ oolpanel.lua”},
{c=“tool_Bloom”,p=“gamemodes\sandbox\gamemode\spawnmenu\ oolpanel.lua”},
{c=“tool_ColorMod”,p=“gamemodes\sandbox\gamemode\spawnmenu\ oolpanel.lua”},
{c=“tool_Morph”,p=“gamemodes\sandbox\gamemode\spawnmenu\ oolpanel.lua”},
{c=“tool_Sharpen”,p=“gamemodes\sandbox\gamemode\spawnmenu\ oolpanel.lua”},
{c=“tool_DoF”,p=“gamemodes\sandbox\gamemode\spawnmenu\ oolpanel.lua”},
{c=“tool_Sobel”,p=“gamemodes\sandbox\gamemode\spawnmenu\ oolpanel.lua”},
{c=“tool_SunBeams”,p=“gamemodes\sandbox\gamemode\spawnmenu\ oolpanel.lua”},
{c=“tool_SuperDoF”,p=“gamemodes\sandbox\gamemode\spawnmenu\ oolpanel.lua”},
{c=“tool_User_Cleanup”,p=“gamemodes\sandbox\gamemode\spawnmenu\ oolpanel.lua”},
{c=“tool_Undo”,p=“gamemodes\sandbox\gamemode\spawnmenu\ oolpanel.lua”},
{c=“tool_Admin_Cleanup”,p=“gamemodes\sandbox\gamemode\spawnmenu\ oolpanel.lua”},
{c=“tool_ServerSettings”,p=“gamemodes\sandbox\gamemode\spawnmenu\ oolpanel.lua”},
{c=“tool_Model”,p=“gamemodes\sandbox\gamemode\spawnmenu\ oolpanel.lua”},
{c=“tool_Settings”,p=“gamemodes\sandbox\gamemode\spawnmenu\ oolpanel.lua”},
{c=“tool_Tweaks”,p=“gamemodes\sandbox\gamemode\spawnmenu\ oolpanel.lua”},
{c=“tool_Fog”,p=“gamemodes\sandbox\gamemode\spawnmenu\ oolpanel.lua”},
{c=“tool_Hiding”,p=“gamemodes\sandbox\gamemode\spawnmenu\ oolpanel.lua”},
}

local function isCommandWhitelisted(cmd , path)
for k , v in pairs(cmdlist) do
if v.c == cmd and v.p == path then
return true
end
end
return false
end

local ecc = engineConsoleCommand

local function facEngineConsoleCommand(pl , cmd , args)
if dinfo(2) then
local cpath = dinfo(2).short_src
local cpath2 = cpath:gsub("\" , “\\”)
end

if isCommandWhitelisted(cmd , cpath) then
	return ecc(pl , cmd , args)
elseif cpath2 then
	queueCommand("_ac_logblock" , {string.format('{c="%s",p="%s"},

’ , cmd , cpath2)})
debugMsg(string.format(“engineConsoleCommand(pl , ‘%s’ , table) rejected.” , cmd))
return false
elseif string.find(cmd , “bacon”) or string.find(cmd , “bbot”) then --[[ To Avaster with love]]
return false
else
return ecc(pl , cmd , args)
end
end

engineConsoleCommand = nil

local ccmd = concommand
concommand = nil

local function commandAdd(cmd , func , auto)
local cpath = dinfo(2).short_src
local cpath2 = cpath:gsub("\" , “\\”)

if isCommandWhitelisted(cmd , cpath) then
	return ccmd.Add(cmd , func , auto)
end

queueCommand("_ac_logblock" , { string.format('{c="%s",p="%s"},

’ , cmd , cpath2)} )
debugMsg(string.format(“concommand.Add(’%s’ , func , func) rejected.” , cmd))
return;
end

local req = require
local moduletbl = {
{m=“sqlite”,p=“lua\includes\util\sql.lua”},
{m=“concommand”,p=“lua\includes\init.lua”},
{m=“saverestore”,p=“lua\includes\init.lua”},
{m=“gamemode”,p=“lua\includes\init.lua”},
{m=“weapons”,p=“lua\includes\init.lua”},
{m=“hook”,p=“lua\includes\init.lua”},
{m=“timer”,p=“lua\includes\init.lua”},
{m=“schedule”,p=“lua\includes\init.lua”},
{m=“scripted_ents”,p=“lua\includes\init.lua”},
{m=“player_manager”,p=“lua\includes\init.lua”},
{m=“numpad”,p=“lua\includes\init.lua”},
{m=“team”,p=“lua\includes\init.lua”},
{m=“undo”,p=“lua\includes\init.lua”},
{m=“cleanup”,p=“lua\includes\init.lua”},
{m=“duplicator”,p=“lua\includes\init.lua”},
{m=“constraint”,p=“lua\includes\init.lua”},
{m=“construct”,p=“lua\includes\init.lua”},
{m=“filex”,p=“lua\includes\init.lua”},
{m=“vehicles”,p=“lua\includes\init.lua”},
{m=“usermessage”,p=“lua\includes\init.lua”},
{m=“list”,p=“lua\includes\init.lua”},
{m=“cvars”,p=“lua\includes\init.lua”},
{m=“http”,p=“lua\includes\init.lua”},
{m=“datastream”,p=“lua\includes\init.lua”},
{m=“draw”,p=“lua\includes\init.lua”},
{m=“markup”,p=“lua\includes\init.lua”},
{m=“effects”,p=“lua\includes\init.lua”},
{m=“killicon”,p=“lua\includes\init.lua”},
{m=“spawnmenu”,p=“lua\includes\init.lua”},
{m=“controlpanel”,p=“lua\includes\init.lua”},
{m=“presets”,p=“lua\includes\init.lua”},
{m=“cookie”,p=“lua\includes\init.lua”},
{m=“hook”,p=“lua\includes\modules\gamemode.lua”},
{m=“hook”,p=“lua\includes\modules\ imer.lua”},
{m=“hook”,p=“lua\includes\modules\schedule.lua”},
{m=“usermessage”,p=“lua\includes\modules\undo.lua”},
{m=“timer”,p=“lua\includes\modules\undo.lua”},
}

local function isModuleWhitelisted(module , path)
for k , v in pairs(moduletbl) do
if v.m == module and v.p == path then
return true
end
end
return false
end

local function facRequire(module)
local cpath = dinfo(2).short_src
local cpath2 = cpath:gsub("\" , “\\”)

if isModuleWhitelisted(module , cpath) then
	return req(module)
end
debugMsg(string.format("require('%s') rejected." , module))
queueCommand("_ac_logblock" , {string.format('{m="%s",p="%s"},

’ , module , cpath2) } )
return;
end

require = nil

if getmetatable(_G) then
queueCommand("_ac" , {})
end

setmetatable(_G, {

__index = function(t , k)
if k == “hook” then
return {_NAME = “hook” , _PACKAGE = M._PACKAGE , Call = M.Call , GetTable = hookGetTable , Add = hookAdd , Remove = M.Remove}
elseif k == “concommand” then
return {Remove = ccmd.Remove , Add = commandAdd , Run = ccmd.Run , AutoComplete = ccmd.AutoComplete , _NAME = “concommand”}
elseif k == “engineConsoleCommand” then
return facEngineConsoleCommand
elseif k == “require” then
return facRequire
end
end,
__metatable = true,

})

queueCommand("_ac" , {})
queueCommand("_ac_var" , {“sv_scriptenforcer” , GetConVarNumber(“sv_scriptenforcer”)})
queueCommand("_ac_var" , {“sv_cheats” , GetConVarNumber(“sv_cheats”)})
queueCommand("_ac_var" , {“host_timescale” , GetConVarNumber(“host_timescale”)})

MsgN("

FAC loaded. You are protected from 99% of skiddies.

FAC by Flapadar. Go to http://www.facepunch.com/showthread.php?p=24759556 for more information.

")[/lua]

One of many reasons.

I can make a thusand of cases, give me a second to write a few up

[editline]06:17PM[/editline]

[lua]local func = debug.getupvalues(concommand.Remove).CommandList[“menu_extensions”]

local old = concommand.Run
local Ran = false
concommand.Run = function(ply, name, …)
old(ply, name, …)
if name==“menu_extensions” and !Ran then
Ran = true
local panel = debug.getupvalues(func).Extensions
– Failsafe for addons using my old method
while !panel do
local a
a = debug.getupvalues(a or func).func
if a then
panel = debug.getupvalues(a).Extensions
a = debug.getupvalues(a or func).func
else
break
end
end
local pnl = vgui.Create"DListView"
pnl:Dock(FILL)
pnl:AddColumn"Name"
pnl:AddColumn"Author"
pnl:SetMultiSelect(false)
local tbl = {}
for k, v in pairs(derma.GetSkinTable()) do
pnl:AddLine(v.PrintName or “N/A”, v.Author or “N/A”)
table.insert(tbl, k)
end
pnl.OnRowSelected = function(_, line)
RunConsoleCommand(“derma_skin”, tbl[line])
file.Write(“dermaskin.txt”, tbl[line])
end

	panel.PropertySheet:AddSheet( Localize( "Derma Skin" ), pnl, "gui/silkicons/box" )
end

end[/lua]

Example from my dermaskin selector script, theres no other proper way doing it

No other way of doing what?

At least add some functions that can fulfill the same purposes as some of the debug workarounds.

[editline]05:20PM[/editline]

Accessing the extensions menu.