General > Developers Corner

Table of convars?

<< < (2/2)

Megiddo:

--- Quote from: JamminR on April 24, 2008, 06:09:11 PM ---Like so?

--- Code: ---MyConVarsTbl = {}
MyConCmd = CreateConVar()
local meta=FindMetaTable("ConVar")
function meta:CreateConVar( var, val )
     //my code creating table
     table.Add( MyConVarsTbl, { var = val } )
    //Normal call
    MyConCmd(var, val)
end

--- End code ---

--- End quote ---

No need to use find meta table, and it should be myConCmd = ConVar.CreateConVar(), but yes.

JamminR:
Thanks for the idea. Not sure about replacing Garry's default commands. Would seem better for all devs if Garry did this already, much like hook.GetTable(), but ConVar.GetTable() instead.
I'm concerned with breaking others, and of course, at what point this loads. Currently, all my code loads from Ulib modules, which seems to load after ulx and wire (and probably others)

There's a command when finishing singleplayer load that gets echoed to console, similiar to something like
---- 48939843 client convars loaded. Use spewconvars_cl to display the list -------
(not exactly that command, but its similiar) It prints out a long list of convars.
I had hoped that would have been from a table.

Megiddo:
That's the wrong convar anyways. It's just the player info stuff. :P

Navigation

[0] Message Index

[*] Previous page

Go to full version