Closed TetraTheta closed 6 months ago
So what exactly is stopping you from implementing the auto complete as you described?
I tried to implement myself few times, but my brain got melted whenever I tried.
When I ask question about this, I wished that if there is any helper function for concommand auto-completion.
If you think this is niche case or trivial, you can close this as 'not planned'.
I think this would be a good addition but I dont know if this is the way to go about it since it controls the autocomplete entirely, maybe concommand.AddWIthAutocomplete(..., {{"a", "b"}, {"c", "d"}})
Would make a good pr since we dont have anything like this atm
I have added an example how to use autocomplete on the wiki: https://wiki.facepunch.com/gmod/concommand.Add
For future reference, you can ask for help on official Discord server (https://discord.gg/gmod). This is not a place for such things.
I know this kind of syntax would not be 'generic', but I really think this kind of stuff will help people whose heads got messed up from creating complicated concommand autocomplete stuff.
Most of concommand would look like this:
Maybe some people prefer putting
[player]
in front of arguments, but I'll start from this syntax.Then here is how the requested function look like:
If
args
ismycmd a
,GenerateAutoComplete()
should return a table like this:This only suggest 'current' and 'next' arguments.
If
args
ismycmd all t
, it should return a table like this:If
args
ismycmd ala
which is not valid argument, it should suggest argument that start with first letter,a
.