General > Developers Corner

Convar table?

(1/2) > >>

JamminR:
Hi fellow lua developers.
Is there a reasonably easy way to grab a table of existing convars matching a string?
Example, I want to make a table of all convars matching "sbox_". I want this to be dynamic in case the server my function will be running on has non-standard sbox settings (such as Wire or other mods that might use sbox_ variables)
In game console, I can type "find sbox_" and a list of all matching sbox convars will be returned.
Is there a way in Lua to get that list? Though I'd expect it would be table, string would be fine and I'll turn it into a table.

Megiddo:
I wanted to do this for a long time as well... :)

The easiest/'best' way would be to override the make convar function.

JamminR:
How would over riding 'make' return a list of unknown variables matching "blah"??
I want a lua equivalent of "find blah", returned in a table/string.

Megiddo:
You keep all the lua-registered convars somewhere you can search.

Chironex:
"cvarlist sbox" ?

Edit: oh, building a table from these results...

Navigation

[0] Message Index

[#] Next page

Go to full version