Skip to content

Commit

Permalink
feat(server/groups): adds error print if a group name contains capita…
Browse files Browse the repository at this point in the history
…l letters
  • Loading branch information
Manason authored Sep 10, 2024
1 parent 3e36e28 commit f804a7e
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
.idea
.vscode/*
!.vscode/extensions.json
!.vscode/settings.json
!.vscode/settings.json
.DS_Store
12 changes: 12 additions & 0 deletions server/groups.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,18 @@ local jobs = require 'shared.jobs'
---@type table<string, Gang>
local gangs = require 'shared.gangs'

for name in pairs(jobs) do
if name ~= name:lower() then
lib.print.error(('jobs.lua contains a job name with capital letters: %s'):format(name))
end
end

for name in pairs(gangs) do
if name ~= name:lower() then
lib.print.error(('gangs.lua contains a gang name with capital letters: %s'):format(name))
end
end

---Adds or overwrites jobs in shared/jobs.lua
---@param newJobs table<string, Job>
function CreateJobs(newJobs)
Expand Down
1 change: 1 addition & 0 deletions shared/gangs.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---Gang names must be lower case (top level table key)
---@type table<string, Gang>
return {
['none'] = {
Expand Down
1 change: 1 addition & 0 deletions shared/jobs.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---Job names must be lower case (top level table key)
---@type table<string, Job>
return {
['unemployed'] = {
Expand Down

0 comments on commit f804a7e

Please sign in to comment.