GMod - What are you working on? October 2017 (#74)
289 replies, posted
[QUOTE=wauterboi;52839546]So far, for my ReBase project:
Today, without documentation:
Gonna be renaming a lot of stuff to the Get() Set() mentality and for consistency.[/QUOTE]
a lot of this seems very niche. can you explain what exactly this is for?
[quote]string.CharAt(str, index)
- Returns a character at given index. A convenience function that runs string.sub(str, index, index)
[/quote]
this is unnecessary
Sure, none of it is necessary. It's just a personal gamemode base that works the way I want it to, and with changes to Garry's Mod base code that I think is convenient to have. I don't like repeating certain things, and I like the idea of inferring what to type out by thinking of what I want to do, i.e. "Get the eye position" becomes "GetEyePosition" and becomes consistent with other functions, like GetPos.
Doing it for fun and also for my own gamemodes. Been showing code_gs what I've been working on and he might join in soon.
[editline]30th October 2017[/editline]
So here's an example of code using my scripts library:
[code]AddCSLuaFile('lib/scripts.lua')
include('lib/scripts.lua')
scripts:IncludeFiles({
['server'] = {
},
['shared'] = {
'lib/override.lua',
'lib/string.lua',
'lib/debug.lua',
'classes/entity.lua',
'includes/modules/widget.lua', -- affected by classes/entity
'lib/global.lua'
},
['client'] = {
}
})[/code]
And to do the equivalent without my library:
[code]
AddCSLuaFile('lib/scripts.lua')
AddCSLuaFile('lib/override.lua')
AddCSLuaFile('lib/string.lua')
AddCSLuaFile('lib/debug.lua')
AddCSLuaFile('classes/entity.lua',)
AddCSLuaFile('includes/modules/widget.lua')
AddCSLuaFile('lib/global.lua')
include('lib/scripts.lua')
include('lib/override.lua')
include('lib/string.lua')
include('lib/debug.lua')
include('classes/entity.lua',)
include('includes/modules/widget.lua')
include('lib/global.lua')
[/code]
And I don't get to see what's included because there is no function to keep track of that. At least I don't think there is. :V
As for string.CharAt, I don't feel like specifying the same index twice. Plus, when I'm thinking of grabbing a character, it seems more natural to say "get char at" as I'm getting the character at an index. (Fortunately, saying that out loud has made me realize that I should change it to GetCharAt()). I don't think "get a sub-string of this string", and I think the code looks less clear than using the convenience function. It's a small thing, but I think they add up and just make things more pleasant.
[editline]30th October 2017[/editline]
After some talking with code_gs, I think it's better to keep in line with other programming languages and keep Get/Set more exclusive to classes, structs, and entities. Changed it back to CharAt().
Wrote about it in my WIP style guide: [url]https://github.com/waut3r/ReBase/wiki/Code-Style[/url]
[QUOTE=wauterboi;52839546]string.CharAt(str, index)[/QUOTE]
[URL]https://github.com/Facepunch/garrysmod/blob/master/garrysmod/lua/includes/extensions/string.lua#L290[/URL]
This is included in Garry's Mod as a metatable __index override.
Example:
[LUA]
("testing")[1]
[/LUA]
I'm working on a simple MOTD for my server.
[t]https://i.imgur.com/VBOaw6u.jpg[/t]
[QUOTE=Vilusia;52842359]I'm working on a simple MOTD for my server.
[t]https://i.imgur.com/VBOaw6u.jpg[/t][/QUOTE]
you should fix the side bar
its blue is too light, the buttons dont fit in
Is this better?
[t]https://i.imgur.com/nTntci0.jpg[/t]
[QUOTE=Vilusia;52842413]Is this better?
[t]https://i.imgur.com/nTntci0.jpg[/t][/QUOTE]
Just a suggestion, but try:
- Changing the margin of the buttons to 2px - 5px all around
- Changing to title bar and sidebar color to the same color as your website's header
- Changing the color of the "Close" button to something that with less contrast (blue + red = eye pain) I would say a darker blue, but it's your project.
I appreciate the feedback I will take this into consideration. Thank you.
[QUOTE=Vilusia;52842413]Is this better?
[t]https://i.imgur.com/nTntci0.jpg[/t][/QUOTE]
The colors are little too strong.
You might find [url]https://material.io/guidelines/style/color.html[/url] useful. Google also have a tool to generate palettes [url]https://material.io/color/#!/?view.left=0&view.right=0[/url]