[B]GetConVarNumber/String[/B]
These two functions are clutter as opposed to the neatly placed ConVarObject:GetInt()/Float() and ConVarObject:GetString() respectively. There also exists cvars.Number(cvarname), cvars.String(cvarname), and cvars.Bool(cvarname) (there is no GetConVarBool).
Internally, cvars.String/Number call GetConVarString/Number. This makes sense when you have a variable name and are writing a helper function to retrieve a given cvar's value. In code where the coder has defined a cvar, it's messy to use the GetConVar* globals (as I assume internally they call a function similar to GetConVar?) and instead use their own ConVar objects.
For the sake of reducing global clutter and variance, I propose marking the GetConVar* as either Internal functions or Deprecated functions, and encouraging ConVarObject:Get*.
There is a problem: The GetConVar* functions are [URL="https://github.com/garrynewman/garrysmod/search?l=lua&q=GetConVarNumber&type=Code&utf8=%E2%9C%93"]used[/URL] [URL="https://github.com/garrynewman/garrysmod/search?l=lua&q=GetConVarString&type=Code&utf8=%E2%9C%93"]extensively[/URL] in the Garry's Mod repository. Devs who read existing code instead of the wiki may still be encouraged to use these functions.
Yeah I agree, also caching the cvarobj and then retrieving the value is much more efficient, that way should be encouraged as a note in those cvar functions
I went ahead and deprecated the two functions. However
[QUOTE=zerf;47873227]There is a problem: The GetConVar* functions are [URL="https://github.com/garrynewman/garrysmod/search?l=lua&q=GetConVarNumber&type=Code&utf8=%E2%9C%93"]used[/URL] [URL="https://github.com/garrynewman/garrysmod/search?l=lua&q=GetConVarString&type=Code&utf8=%E2%9C%93"]extensively[/URL] in the Garry's Mod repository. Devs who read existing code instead of the wiki may still be encouraged to use these functions.[/QUOTE]
still applies.
Does anyone else notice that the functions on the sidebar sometimes don't appear?
If you reload it sometimes works
[vid]http://reversedby.me/s/mdm-hA87OQ.webm[/vid]
I find it just simply slow to load. The times it isn't is because it's cached by the browser:
[img]http://i.imgur.com/aLJy8oM.png[/img]
Heyo, just wondering, how hard would it be to implement an optional "See also" template, and possibly adding it to forms/panels/hooks?
Here's an example from [URL="https://love2d.org/wiki/love.window"]love2d's wiki[/URL], although they do it manually for each page, having it as a template would be cool.
Or it'd be completely dumb and I'm better off doing it manually on my own.
Just use do it manually, since there's really no way to automate this.
[url]http://wiki.garrysmod.com/page/Global/SortedPairsByMemberValue[/url]
[QUOTE=zerf;47878775]I went ahead and deprecated the two functions. However
still applies.[/QUOTE]
So it was you who deprecated them... I was wondering why the day before they weren't deprecated but then the next day they were :v:
[QUOTE=Shenesis;48500985]Has this been mentioned yet?
[IMG]http://i.imgur.com/CdXYij1.png[/IMG][/QUOTE]
This fixed some time ago and I also included the functionality from this thread:
[url]https://facepunch.com/showthread.php?t=1483654[/url]
And also made it so that searching ENT:* and SWEP:* shows proper results.
The search changes will be live soon.
[editline]26th September 2015[/editline]
[img]http://i.imgur.com/3jNx4ZU.png[/img]
:snip:
I was dumb by that time
[QUOTE=geferon;48769449]I think you are one month late[/QUOTE]
What?
[QUOTE=Robotboy655;48769738]What?[/QUOTE]
The post you replied to was from a month ago.
So? He's one month late but he still implemented it, so I don't see how's that relevant.
[QUOTE=TheEmp;46454156]Do you think you could take a look at the sidebar not scaling down for mobile devices?
[url]http://m.imgur.com/cNKmF5Y,sIXomWu,dtFeNRc[/url]
Id really apreachate if it could be fixed. :wink:[/QUOTE]
Can this please be fixed? It still happens on my iPhone(using the Google Chrome App). It makes trying to use the wiki when you zoom in near impossible.
[QUOTE=TheEmp;48771692]Can this please be fixed? It still happens on my iPhone(using the Google Chrome App). It makes trying to use the wiki when you zoom in near impossible.[/QUOTE]
I am pretty sure I fixed it ages ago ( using JavaScript ), it works properly on my Android device with latest Chrome.
Zoomed out:
[t]http://i.imgur.com/myAJrdL.png[/t]
Zoomed in:
[t]http://i.imgur.com/AAiNQSa.png[/t]
[editline]27th September 2015[/editline]
I honestly don't see why would you need to view the wiki on mobile, it is really only useful when developing stuff/setting up servers/etc, none of which is really a good idea to do from a mobile device.
And don't even try to tell me you use it "as a secondary side-by-side screen with the wiki page open"
[QUOTE=Robotboy655;48771841]I am pretty sure I fixed it ages ago ( using JavaScript ), it works properly on my Android device with latest Chrome.
Zoomed out:
[t]http://i.imgur.com/myAJrdL.png[/t]
Zoomed in:
[t]http://i.imgur.com/AAiNQSa.png[/t]
[editline]27th September 2015[/editline]
I honestly don't see why would you need to view the wiki on mobile, it is really only useful when developing stuff/setting up servers/etc, none of which is really a good idea to do from a mobile device.
And don't even try to tell me you use it "as a secondary side-by-side screen with the wiki page open"[/QUOTE]
my keyboard has a phone dock. I'd put my phone in it, and use it as a secondary side-by-side screen with the wiki page open.
[QUOTE=HDG_MrDeeJayy;48771875]my keyboard has a phone dock. I'd put my phone in it, and use it as a secondary side-by-side screen with the wiki page open.[/QUOTE]
It's 452% faster to alt tab into your browser, type in wiki.garrysmod.com, click on the search field, type in your request and select the function you seek, than to fuck around with your phone and its tiny ass keyboard.
[QUOTE=Robotboy655;48771910]It's 452% faster to alt tab into your browser, type in wiki.garrysmod.com, click on the search field, type in your request and select the function you seek, than to fuck around with your phone and its tiny ass keyboard.[/QUOTE]
You clearly don't know my PC.
The P stands for Potato.
[QUOTE=Robotboy655;48771910]It's 452% faster to alt tab into your browser, type in wiki.garrysmod.com, click on the search field, type in your request and select the function you seek, than to fuck around with your phone and its tiny ass keyboard.[/QUOTE]
Ohhhhh here's an idea for Gmod 2 or whatever name was picked: an in game IDE which can search the wiki.
[QUOTE=James xX;48771932]Ohhhhh here's an idea for Gmod 2 or whatever name was picked: an in game IDE which can search the wiki.[/QUOTE]
GMod 2 will not have in game IDE.
[QUOTE=Robotboy655;48772040]GMod 2 will not have in game IDE.[/QUOTE]
Will gmod 2 at least stop being a hipster and get a name already?
[QUOTE=James xX;48771932]Ohhhhh here's an idea for Gmod 2 or whatever name was picked: an in game IDE which can search the wiki.[/QUOTE]
[url]https://facepunch.com/showthread.php?t=1485586[/url] ? I mean it doesn't query the wiki as you type, but it is scraped beforehand, so it contains basically the same information.
Is it easy/would it look nice if the "default args" part of the function template was styled with the tokenizer?
Something like (but for all args):
[IMG]http://i.imgur.com/ysoeweQ.png[/IMG]
[editline]wew[/editline]
Another idea I'd like to bring up is a cvar + ccmd list on the wiki. The help text for commands and the "find" console command help with this in-game but it would be nice to have a central, fully descriptive and searchable list.
Looks like I'm getting duplicated pages for DProperty_Combo and DProperty_VectorColor in the panels list.
[IMG]http://i.imgur.com/00pWCww.png[/IMG]
I tested in both chrome and firefox.
[QUOTE=zerf;49691007]Looks like I'm getting duplicated pages for DProperty_Combo and DProperty_VectorColor in the panels list.
[IMG]http://i.imgur.com/00pWCww.png[/IMG]
I tested in both chrome and firefox.[/QUOTE]
Looks like ones are with a "_" and others without it.
[editline]7th February 2016[/editline]
It may be someone that made them without it beacouse they couldnt find the normal ones.
I created a script that iterates over all methods of a given panel and checks if they're documented on the wiki. It works really well:
[lua]
local function PageExists(title, callback)
http.Fetch("http://wiki.garrysmod.com/api.php?action=query&format=json&indexpageids=&titles=" .. title, function(b)
local json = util.JSONToTable(b)
callback(tostring(json.query.pageids[1]) ~= "-1")
end)
end
local function GetPanelMeta(name)
local p = vgui.Create(name)
local m = getmetatable(p)
p:Remove()
return m
end
local function GetPanelFields(name)
local p = vgui.Create(name)
local m = p:GetTable()
p:Remove()
return m
end
local PANEL = FindMetaTable("Panel")
concommand.Add("gibpanel", function(_, _, _, n)
print(n .. ": ")
local mt = GetPanelMeta(n)
if mt == PANEL then
print("\tMeta: (PANEL)")
else
print("\tMeta:")
PrintTable(mt, 2)
end
print("\tFields:")
PrintTable(GetPanelFields(n), 2)
end)
local function getbasename(n, callback) -- too lazy to find a thing for getting mediawiki template fields from the api
http.Fetch("http://wiki.garrysmod.com/page/Category:" .. n, function(b)
local base = string.match(b, [[<p><b>Parent:</b> <a href="/page/Category:.-" title="Category:.-">(.-)</a></p>]])
callback(base)
end)
end
local function checkbases(func, n, callback) -- todo: check for existence in base's tables to properly categorize functions
getbasename(n, function(b)
if not b then callback(false) return end
PageExists(b .. "/" .. func, function(exists)
if exists then
callback(true, b)
elseif b then
checkbases(func, b, callback)
else
callback(false)
end
end)
end)
end
concommand.Add("checkpanel", function(_, _, _, n)
local t = GetPanelFields(n)
local methods = 0
local checked = 0
local missing = 0
for k, v in pairs(t) do
if type(v) == "function" then
methods = methods + 1
PageExists(n .. "/" .. tostring(k), function(exists)
if not exists then
PageExists("PANEL/" .. tostring(k), function(exists2)
if not exists2 then
-- check baseclasses
checkbases(tostring(k), n, function(exists3, foundin)
if not exists3 then
print("Undocumented method: " .. n .. "." .. tostring(k))
missing = missing + 1
else
-- print("Found method " .. n .. "." .. tostring(k) .. " in parent " .. foundin)
end
checked = checked + 1
if checked == methods then
print("All done.", "Documented: " .. methods - missing .. "/" .. methods)
end
end)
else
checked = checked + 1
if checked == methods then
print("All done.", "Documented: " .. methods - missing .. "/" .. methods)
end
end
end)
else
checked = checked + 1
if checked == methods then
print("All done.", "Documented: " .. methods - missing .. "/" .. methods)
end
end
end)
end
end
end)
[/lua]
If you're wondering what callback hell looks like, there it is. Because of the many, many http request made the script takes a while to execute (about 30-60 seconds). It needs some improvement (see the todos), but it works. The only major flaw is that methods that should be documented for bases are listed as undocumented for children.
Usage: checkpanel <name>
Here's some sample output for DButton (oh my):
[code]
Undocumented method: DButton.SetDrawBackground
Undocumented method: DButton.DoClickInternal
Undocumented method: DButton.GetBright
Undocumented method: DButton.SetIsMenu
Undocumented method: DButton.GenerateExample
Undocumented method: DButton.OnReleased
Undocumented method: DButton.GetTextStyleColor
Undocumented method: DButton.SetTextStyleColor
Undocumented method: DButton.GetDark
Undocumented method: DButton.SetIcon
Undocumented method: DButton.SetColor
Undocumented method: DButton.DoDoubleClick
Undocumented method: DButton.GetColor
Undocumented method: DButton.SetDoubleClickingEnabled
Undocumented method: DButton.GetDrawBorder
Undocumented method: DButton.DoDoubleClickInternal
Undocumented method: DButton.GetHighlight
Undocumented method: DButton.DoMiddleClick
Undocumented method: DButton.UpdateFGColor
Undocumented method: DButton.GetPaintBackground
Undocumented method: DButton.GetIsMenu
Undocumented method: DButton.OnDepressed
Undocumented method: DButton.GetTextColor
Undocumented method: DButton.DoRightClick
Undocumented method: DButton.SetPaintBackground
Undocumented method: DButton.SetDrawBorder
Undocumented method: DButton.GetDoubleClickingEnabled
Undocumented method: DButton.GetDrawBackground
Undocumented method: DButton.GetAutoStretchVertical
Undocumented method: DButton.UpdateColours
Undocumented method: DButton.SetHighlight
All done. Documented: 28/59
[/code]
Lots of action in the wiki today! (most of it is positive!)
One question came up:
The Shaders page ( [url]http://wiki.garrysmod.com/page/Category:Shaders[/url] ) is currently filled with a bunch of [[Shaders/shadername|shadername]] links, so a link template like [url=http://wiki.garrysmod.com/page/Template:Enum]Enum[/url] would be nice. I went and made one, but couldn't name it Shader since Template:Shader is already used for the actual shader pages. So I called it ShaderLink. I'm not pleased with the name and neither is zerf, so any suggestions for the name of the template are appreciated.
Note that a link to a hook is Template:HookFunction, a link to a library function is Template:LibraryFunction, etc, a link to an enum is Template:Enum and the enum's page uses Template:Enumeration.
I can't think of any such connected words with shaders, there's really only one word associated with it (shader). Enum cheated by using the long and short versions for the two uses.
Maybe MaterialShader?
Relevant talk page:
[url]http://wiki.garrysmod.com/page/Template_talk:ShaderLink[/url]
Template's currently at:
[url]http://wiki.garrysmod.com/page/Template:ShaderLink[/url]
Edit: I'm quite pleased with MaterialShader. Agree/Disagree?
Material shader implies there're non material shaders. ShaderLink is as good name as any
Is there a reason that the Sparkle effect is listed in the [URL="https://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/indexe14a.html"]old wiki page[/URL] but not [URL="http://wiki.garrysmod.com/page/Engine_Effects"]the new one[/URL]? Did it get removed or something, or did it never exist in the first place?
[editline]9th April 2016[/editline]
I decided to attempt to merge the [URL="http://wiki.garrysmod.com/page/Engine_Effects"]Engine Effects[/URL] page and the [URL="http://wiki.garrysmod.com/page/Lua_Effects"]Lua Effects[/URL] page with [URL="http://wiki.garrysmod.com/page/Effects"]this new page[/URL], maybe someone could make the other two pages redirect to the new one? I already redirected the link on the [URL="http://wiki.garrysmod.com/page/util/Effect"]util.Effect page[/URL] so it goes to the new one
[editline]9th April 2016[/editline]
I attempted to redirect them, feel free to make the redirection a bit better
[QUOTE=MPan1;50097949]Is there a reason that the Sparkle effect is listed in the [URL="https://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/indexe14a.html"]old wiki page[/URL] but not [URL="http://wiki.garrysmod.com/page/Engine_Effects"]the new one[/URL]? Did it get removed or something, or did it never exist in the first place?[/QUOTE]
The "new" page lists all of the engine effects as generated by the engine itself, so it contains only the effects that are actually usable in-game.
Sorry, you need to Log In to post a reply to this thread.