What? If that's what I think you just disabled, Why the hell?
[QUOTE=garry;24822384][B]Revision 595[/B]
[INDENT]Disabled Lua's debug library[/INDENT][B]Changed Files:[/B]
[LIST]
[*]trunk/src_garrysmod/public/Lua/ldblib.c
[/LIST]
Committed By [B]Garry Newman[/B][/QUOTE]
Big mistake.
[QUOTE=|FlapJack|;24822491]Big mistake.[/QUOTE]
Err, not really. You shouldn't be making addons that are dependent on a debug system.
[QUOTE=Marlamin;24822516]Err, not really. You shouldn't be making addons that are dependent on a debug system.[/QUOTE]
Ok, I'll just verify that a call to a function's coming from a file it should be [b]with default functions[/b].
Any chance we could get debug.traceback left in? It's really nice for error messages...
[QUOTE=Megiddo;24822540]Any chance we could get debug.traceback left in? It's really nice for error messages...[/QUOTE]
Or he could just leave the library as it was?
[QUOTE=iRzilla;24822572]FlapJack mad. His hacks won't work :downs:[/QUOTE]
They will, but now I need to do a fucktonne of work for the next GMod update.
[QUOTE=iRzilla;24822572]FlapJack mad. His hacks won't work :downs:[/QUOTE]
Garry broke some hacks? Awww. :v:
[QUOTE=Marlamin;24822586]Garry broke some hacks? Awww. :v:[/QUOTE]
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.
[QUOTE=garry;24822605]Sounds like some stuff was coded using hacky, unreliable methods, and in the next update it will all break because of that.[/QUOTE]
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\\timer.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
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?
I don't want people adding things to the extensions menu. If I did, there'd be a method for it. What if I decide to delete the extensions menu and create something new?
Whatever relies on this breaks.
even if garry made a way to access the panel, theres a few thusand other similar cases anyways.
[QUOTE=garry;24822716]I don't want people adding things to the extensions menu. If I did, there'd be a method for it. What if I decide to delete the extensions menu and create something new?
Whatever relies on this breaks.[/QUOTE]
What about checking call paths, like I do in my anticheat? I don't want to be doing entire tracebacks just to access the callpath.
stack Traces, omg.
Finding out which file a function comes from: This allowed me to figure out what errored with timer.Simple:
[LUA]
local info=debug.getinfo(value.Func)
local argstable=value.Args
if #argstable>0 then
argstable=table.ToString(argstable,"Args")
else
argstable=nil
end
ErrorNoHalt( "Timer-Simple ERROR: "..(argstable and argstable.." " or "")..
"Issuer: "..tostring(info and tostring(info.short_src) !="" and tostring(info.short_src) or "Unknown")..
"\n Msg: "..tostring(e).."\n" )
[/LUA]
Excuse the bad coding. I wrote it half a year ago.
Wiremod relies on some debug stuff
[LUA]
./entities/gmod_wire_expression2/core/e2lib.lua: if type(value) ~= argtype then error(string.format("bad argument #%d to 'E2Lib.%s' (%s expected, got %s)", argn, debug.getinfo(2,"n").name, argtype, type(text)),2) end
[/LUA]
Debug traces are extremely handy when something errors for example on string library. Then I can just mod the string library and figure out with a stack trace which addon is malfunctioning.
[LUA]
./weapons/gmod_tool/stools/tbduplicator.lua: debug.sethook() //prevent infinite loop
[/LUA]
Bad example, but occasionally useful. Especially when first-loading for example a ban file, that has a lot of bans or something else as much time consuming.
Oh and:
[CODE]
./vgui/dscrollpanel.lua: debug.Trace()
./vgui/dpanellist.lua: debug.Trace()
./vgui/spawnicon.lua: if (!mdl) then debug.Trace() return end
[/CODE]
Please, let us at least use it on the server.
Also, garry: we will always create workarounds, theres no soloution against it except for making our work harder by a tenfold
debug.getinfo is still in
Case of getinfo in one of my unreleased addons:
[lua]
local oldinclude = _G.include
_G.include = function(name, ...)
if name == "compat.lua" and debug.getinfo(2, "S").short_src == "lua\\includes\\init.lua" then
include"optimalus/override/init.lua"
error("Blocked Default Init", 0)
end
return oldinclude(name, ...)
end[/lua]
[editline]06:25PM[/editline]
Argh ninja :ninja:
[QUOTE=garry;24822756]debug.getinfo is still in[/QUOTE]
[lua]if debug.getupvalue(file.Exists , 1) != "something" then[/lua]
Can be used for detecting if someone's detoured a function. Like BaconBot does. So you can detect baconbot.
No more debug.getparams
[url]http://www.facepunch.com/showthread.php?t=884409[/url]
:(
[QUOTE=garry;24822605]Sounds like some stuff was coded using hacky, unreliable methods, and in the next update it will all break because of that.[/QUOTE]
We wouldn't have to use unreliable hacky methods if you just gave us access to what we want. YOU'RE causing the problem, not us.
[QUOTE=garry;24822716]I don't want people adding things to the extensions menu. If I did, there'd be a method for it. [b]What if I decide to delete the extensions menu and create something new?[/b]
Whatever relies on this breaks.[/QUOTE]
Then we update our code to accommodate ANOTHER Lua breaking update. That's not new for us or anything. Also, if the code relies on the menu, then the maker is an idiot. All it does is provide us with a nice GUI that is easily accessible from a user. But really, don't be unreasonable, you can do some really handy stuff with the extensions menu.
[img_thumb]http://blackopsservers.com/imageupload/?di=15128448583811[/img_thumb][img_thumb]http://ahb.me/oPm[/img_thumb]
This whole situation is just retarded. It would be like Valve disabling the HTML panels just because garry uses it for an in game menu. Durr that's hacky, you should make it an actual menu. :downs:
Blackops explained it perfectly, i like how your forcing us to use proper stuff like Angles instead of vectors is bad, but your removing a fully functional way of doing stuff, even though its hacky some stuff has to be
Sorry, you need to Log In to post a reply to this thread.