You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+27-22Lines changed: 27 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -27,43 +27,46 @@ Also, you can run an existing addon via gpm, just add the code below to `package
27
27
```lua
28
28
-- lua/packages/example-package/package.lua
29
29
name="example-package"
30
-
main="init.lua"
31
-
version=1
30
+
version=000100
32
31
33
-
-- allowed sides to run package, if client is false then the server will not send anything
34
-
client=true
35
-
server=true
32
+
-- Files to be used as an entry point into the package, supports relative paths and global relative to "lua/"
33
+
init= {
34
+
["client"] ="cl_init.lua",
35
+
["server"] ="init.lua",
36
+
["menu"] ="init.lua"
37
+
}
36
38
37
-
--if there is no autorun, the package will wait for import from another package
39
+
--If there is no autorun, the package will wait for import from another package
38
40
autorun=true
39
41
40
-
--don't touch it if you don't know what you're doing
42
+
--Don't touch it if you don't know what you're doing
41
43
environment=true
42
44
43
-
--client files
45
+
--Client files ( supports relative paths and global paths by "lua/" )
44
46
send= {
45
-
"my/client/file.lua",
46
-
"my/client/file2.lua"
47
+
"file.lua",
48
+
"my_addon/file2.lua"
47
49
}
48
50
49
-
--if false, the logger will not be created by default
51
+
--If false, the logger will not be created by default and logs color
50
52
logger=false
51
53
color=Color( 255, 255, 0 )
52
54
53
-
-- if nil, all gamemodes are allowed
55
+
--Allowed gamemodes list, if nil then all gamemodes are allowed
54
56
gamemodes= {
55
57
"sandbox",
56
58
"darkrp"
57
59
}
58
60
59
-
-- if nil, all maps are allowed
61
+
--Allowed maps list, if nil then all maps are allowed
60
62
maps= {
61
63
"gm_construct"
62
64
}
63
65
64
-
--if true, then the package is allowed to run only in a singleplayer game
66
+
--If true, then the package is allowed to run only in a singleplayer game
65
67
singleplayer=false
66
68
69
+
-- Enables automatic naming for listed libraries, e.g. all hooks with hook = true will have a package identifier in the hook name, if the hook name is a string of course...
67
70
autonames= {
68
71
["properties"] =true,
69
72
["timer"] =true,
@@ -81,14 +84,16 @@ autonames = {
81
84
-### Package version (`version`) (def. `nil`)
82
85
By default, the version is a number whose format is { 00 } { 00 } { 00 } = 0.0.0, you can also use your own version format, just put your version here as a string.
83
86
84
-
-### Package entry point (`main`) (def. `init.lua`)
85
-
The `main` in this case is the entry point to the package (where the code execution will start from), you can use either the full `lua/` path, for example 'lua/packages/example-package/init.lua' or a local path relative to your package folder.
86
-
87
-
-### Package client entry point (`cl_main`) ( def. `nil`)
88
-
An optional parameter that substitutes `main` with another file for the client, helps to easily separate the client and server sides.
87
+
-### Package init (`init`)
88
+
This is a universal parameter, which can be either a string or a table, in case it is a string, the package will run on both server and client and menu using the same initialization point, but if it is a table, it must contain parameters like ["realm"] = "path/to/init. lua", if any side is not specified then it won't be launched/sent, i.e. if we specify this value to {["server"] = "init.lua"} the package will only run on server and won't be sent to clients and also will not support menu realm.
89
89
90
-
-### Client and server (`client`, `server`, `menu`) (def. `true`, `true`, `false`)
91
-
You can change the permissions to run a package, for example if you set `client` to `false` the client will not be able to run it, moreover it will not even know that such a package exists and therefore will not see its files. `menu` is works only in menu realm.
If set to `true` then a personal logger object will be created in the package environment, to easily send logs to the console. If necessary, you can create a logger object yourself, just call `gpm.logger.Create( name, color )` (`name` is `string`, `color` is `Color`).
0 commit comments