aboutsummaryrefslogtreecommitdiff
path: root/gamemode/shared.lua
diff options
context:
space:
mode:
authorAlexander Pickering <alexandermpickering@gmail.com>2017-01-04 23:27:36 -0500
committerAlexander Pickering <alexandermpickering@gmail.com>2017-01-04 23:27:36 -0500
commit4879eb1d78520ce0ac9b0bb0ef5244cf65ad7c99 (patch)
treeac47724191a8959c19b2408d4da384d64b6098ec /gamemode/shared.lua
parent2c4329e2b6e19182a441f79a5c3010011f8ae767 (diff)
downloadartery-4879eb1d78520ce0ac9b0bb0ef5244cf65ad7c99.tar.gz
artery-4879eb1d78520ce0ac9b0bb0ef5244cf65ad7c99.tar.bz2
artery-4879eb1d78520ce0ac9b0bb0ef5244cf65ad7c99.zip
Started refactoring item and inventory system
Diffstat (limited to 'gamemode/shared.lua')
-rw-r--r--gamemode/shared.lua78
1 files changed, 6 insertions, 72 deletions
diff --git a/gamemode/shared.lua b/gamemode/shared.lua
index 38e63bb..588b81f 100644
--- a/gamemode/shared.lua
+++ b/gamemode/shared.lua
@@ -1,72 +1,6 @@
-local a = include("autolua.lua")
-
-ART = {}
-a.AddLuaSHFolder("utility",true)
-a.AddMixedFolder("core",true)
-a.AddLuaSHFolder("shared",true)
-a.AddLuaCSFolder("client",true)
-a.AddLuaSVFolder("server",true)
-a.AddMixedFolder("tools",true)
-
-
-GM.Name = "Artery"
-GM.Author = "Alexander \"Apickx\" Pickering"
-GM.Email = "apickx@cogarr.org"
-GM.Website = "cogarr.net"
-
---Some global functions that are helpful
--- printf
--- assertf
--- curry
--- typecheck
-
---printf from C
-function printf(fmt, ...)
- print(string.format(fmt,...))
-end
-
---Assert with a formated string
-function assertf(cond, fmt, ...)
- assert(cond,string.format(fmt,...))
-end
-
---Curry from lisp, allows you to store variables "in" a function, so you can call it with fewer arguments if you'll be repeating arguments a lot
---Ex:
--- >dbprint = curry(print,"[Debug]")
--- >dbprint("Hello, world!")
--- [Debug] Hello, world!
--- >
-function curry(fnc, ...)
- local oarg = {...}
- return function(...)
- return fnc(unpack(oarg),unpack({...}))
- end
-end
-
---Does type checking for functions, use by supplying a table whith the variables and the types they should be
---Ex:
--- >local somefunction(str, tbl, num)
--- >>typecheck({
--- >> str,"string",
--- >> tbl,"table",
--- >> num,"number"
--- >>})
--- >
-function typecheck(...)
- local tbl = {...}
- tbl = type(tbl[1]) == "table" and tbl[1] or tbl
- for k=1,#tbl,2 do
- local t,n = type(tbl[k]),tbl[k+1]
- assertf(t == n, "Passed argument of wrong type, should have been %q but was %q",t,n )
- end
-end
-
---Add a thing to report errors to a master server
---TODO:Set up a master server to collect errors for correction
---[[
-local olderr = error
-function error(str)
- print("I got an error!")
- olderr(str)
-end
-]]
+include("nrequire.lua")
+local ngm = GM or GAMEMODE
+ngm.Name = "Artery"
+ngm.Author = "Alexander \"Apickx\" Pickering"
+ngm.Email = "apickx@cogarr.org"
+ngm.Website = "cogarr.net"