Skip to content

Commit

Permalink
(formatting) use more lua standard formatting (tabs, 4 space width)
Browse files Browse the repository at this point in the history
  • Loading branch information
luttje committed Dec 1, 2024
1 parent 9f5385b commit 91acffc
Show file tree
Hide file tree
Showing 215 changed files with 6,284 additions and 6,395 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ trim_trailing_whitespace = true

[*.lua]
indent_style = space
indent_size = 2
indent_size = 4

[*.js]
indent_style = space
Expand Down
44 changes: 22 additions & 22 deletions gmod-addon/lua/autorun/sh_jestronaut.lua
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
-- Gmod's require doesn't return any values, so we replace require with include while loading jestronaut
-- This is a hacky way to make jestronaut work with Gmod
local function callWithRequireCompat(func)
local oldRequire = require
local alreadyRequired = {}

package.path = package.path or ""

require = function(path)
if (alreadyRequired[path] == nil) then
if (file.Exists(path .. ".lua", "LUA")) then
alreadyRequired[path] = {include(path .. ".lua")}
else
Msg("Could not find file: " .. path)
return false
end
local oldRequire = require
local alreadyRequired = {}

package.path = package.path or ""

require = function(path)
if (alreadyRequired[path] == nil) then
if (file.Exists(path .. ".lua", "LUA")) then
alreadyRequired[path] = { include(path .. ".lua") }
else
Msg("Could not find file: " .. path)
return false
end
end

return unpack(alreadyRequired[path])
end

return unpack(alreadyRequired[path])
end
local result = func()

local result = func()
require = oldRequire

require = oldRequire

return result
return result
end

local jestronaut = callWithRequireCompat(function()
local jestronaut = include("jestronaut.lua")
local jestronaut = include("jestronaut.lua")

GmodReporter = include("sh_jestronaut_gmod_reporter.lua").newGmodReporter()
GmodReporter = include("sh_jestronaut_gmod_reporter.lua").newGmodReporter()

return jestronaut
return jestronaut
end)

jestronaut.callWithRequireCompat = callWithRequireCompat
Expand Down
Loading

0 comments on commit 91acffc

Please sign in to comment.