Skip to content

Commit

Permalink
DOCS-24: update api ref for 1.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Cuh4 authored and gitbook-bot committed Jun 17, 2024
1 parent 5fbffe1 commit e508ace
Show file tree
Hide file tree
Showing 7 changed files with 216 additions and 19 deletions.
2 changes: 2 additions & 0 deletions docs/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
* [PlayerClass](api-reference/noir/built-ins/classes/playerclass.md)
* [ServiceClass](api-reference/noir/built-ins/classes/serviceclass.md)
* [TaskClass](api-reference/noir/built-ins/classes/taskclass.md)
* [CommandClass](api-reference/noir/built-ins/classes/commandclass.md)
* [Libraries](api-reference/noir/built-ins/libraries/README.md)
* [Events](api-reference/noir/built-ins/libraries/events.md)
* [Logging](api-reference/noir/built-ins/libraries/logging.md)
Expand All @@ -30,6 +31,7 @@
* [PlayerService](api-reference/noir/built-ins/services/playerservice.md)
* [TaskService](api-reference/noir/built-ins/services/taskservice.md)
* [GameSettingsService](api-reference/noir/built-ins/services/gamesettingsservice.md)
* [CommandService](api-reference/noir/built-ins/services/commandservice.md)
* [Bootstrapper](api-reference/noir/bootstrapper.md)
* [Callbacks](api-reference/noir/callbacks.md)
* [Class](api-reference/noir/class.md)
Expand Down
73 changes: 73 additions & 0 deletions docs/api-reference/noir/built-ins/classes/commandclass.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# CommandClass

**Noir.Classes.CommandClass**: `NoirClass`

Represents a command.

***

```lua
Noir.Classes.CommandClass:Init(name, aliases, requiredPermissions, requiresAuth, requiresAdmin, capsSensitive, description)
```

Initializes command class objects.

#### Parameters

* `name`: string
* `aliases`: table\<integer, string>
* `requiredPermissions`: table\<integer, string>
* `requiresAuth`: boolean
* `requiresAdmin`: boolean
* `capsSensitive`: boolean
* `description`: string

***

```lua
Noir.Classes.CommandClass:_Use(player, message, args)
```

Trigger this command.

Used internally. Do not use in your code.

#### Parameters

* `player`: NoirPlayer
* `message`: string
* `args`: table

***

```lua
Noir.Classes.CommandClass:_Matches(query)
```

Returns whether or not the string matches this command.

Used internally. Do not use in your code.

#### Parameters

* `query`: string

#### Returns

* `boolean`

***

```lua
Noir.Classes.CommandClass:CanUse(player)
```

Returns whether or not the player can use this command.

#### Parameters

* `player`: NoirPlayer

#### Returns

* `boolean`
17 changes: 12 additions & 5 deletions docs/api-reference/noir/built-ins/classes/serviceclass.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,43 +2,50 @@

**Noir.Classes.ServiceClass**: `NoirClass`

A class that represents a service.
Represents a Noir service.

***

```lua
Noir.Classes.ServiceClass:Init(name)
Noir.Classes.ServiceClass:Init(name, isBuiltIn)
```

Initializes service class objects.

#### Parameters

* `name`: string
* `isBuiltIn`: boolean

***

```lua
Noir.Classes.ServiceClass:_Initialize()
```

Start this service. Used internally.
Start this service.

Used internally.

***

```lua
Noir.Classes.ServiceClass:_Start()
```

Start this service. Used internally.
Start this service.

Used internally.

***

```lua
Noir.Classes.ServiceClass:_CheckSaveData()
```

Checks if g\_savedata is intact. Used internally.
Checks if g\_savedata is intact.

Used internally.

#### Returns

Expand Down
84 changes: 84 additions & 0 deletions docs/api-reference/noir/built-ins/services/commandservice.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# CommandService

**Noir.Services.CommandService**: `NoirService`

A service for easily creating commands with support for command aliases, permissions, etc.

***

```lua
Noir.Services.CommandService:FindCommand(query)
```

Get a command by the name or alias.

#### Parameters

* `query`: string

#### Returns

* `NoirCommand|nil`

***

```lua
Noir.Services.CommandService:CreateCommand(name, aliases, requiredPermissions, requiresAuth, requiresAdmin, capsSensitive, description, callback)
```

Create a new command.

#### Parameters

* `name`: string - The name of the command (eg: if you provided "help", the player would need to type "?help" in chat)
* `aliases`: table\<integer, string> - The aliases of the command
* `requiredPermissions`: table\<integer, string>|nil - The required permissions for this command
* `requiresAuth`: boolean|nil - Whether or not this command requires auth
* `requiresAdmin`: boolean|nil - Whether or not this command requires admin
* `capsSensitive`: boolean|nil - Whether or not this command is case-sensitive
* `description`: string|nil - The description of this command
* `callback`: fun(player: - NoirPlayer, message: string, args: table\<integer, string>, hasPermission: boolean)

#### Returns

* `NoirCommand`

***

```lua
Noir.Services.CommandService:GetCommand(name)
```

Get a command by the name.

#### Parameters

* `name`: string

#### Returns

* `NoirCommand|nil`

***

```lua
Noir.Services.CommandService:RemoveCommand(name)
```

Remove a command.

#### Parameters

* `name`: string

***

```lua
Noir.Services.CommandService:GetCommands()
```

Returns all commands.

#### Returns

* `table<string, NoirCommand>`
24 changes: 12 additions & 12 deletions docs/api-reference/noir/built-ins/services/objectservice.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,6 @@ Used internally. Do not use in your code.

***

```lua
Noir.Services.ObjectService:GetObjects()
```

Get all objects.

#### Returns

* `table<integer, NoirObject>`

***

```lua
Noir.Services.ObjectService:_SaveObjectSavedata(object)
```
Expand Down Expand Up @@ -74,6 +62,18 @@ Used internally. Do not use in your code.

***

```lua
Noir.Services.ObjectService:GetObjects()
```

Get all objects.

#### Returns

* `table<integer, NoirObject>`

***

```lua
Noir.Services.ObjectService:RegisterObject(object_id)
```
Expand Down
6 changes: 5 additions & 1 deletion docs/api-reference/noir/built-ins/services/playerservice.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Used internally.

#### Parameters

* `steam_id`: string
* `steam_id`: integer
* `name`: string
* `peer_id`: integer
* `admin`: boolean
Expand Down Expand Up @@ -101,6 +101,10 @@ Used internally. Do not use in your code.

* `player`: NoirPlayer

#### Returns

* `table<string, boolean>|nil`

***

```lua
Expand Down
29 changes: 28 additions & 1 deletion docs/api-reference/noir/services.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Do not modify this table directly. Please use `Noir.Services:GetService(name)` i
***

```lua
Noir.Services:CreateService(name)
Noir.Services:CreateService(name, isBuiltIn)
```

Create a service.
Expand All @@ -27,6 +27,7 @@ This service will be initialized and started after `Noir:Start()` is called.
#### Parameters

* `name`: string
* `isBuiltIn`: boolean|nil

#### Returns

Expand All @@ -49,3 +50,29 @@ This will error if the service hasn't initialized yet.
#### Returns

* `NoirService|nil`

***

```lua
Noir.Services:GetBuiltInServices()
```

Returns all built-in Noir services.

#### Returns

* `table<string, NoirService>`

***

```lua
Noir.Services:RemoveBuiltInServices(exceptions)
```

Removes built-in services from Noir. This may give a very slight performance increase.

**Use before calling Noir:Start().**

#### Parameters

* `exceptions`: table\<integer, string> - A table containing exact names of services to not remove

0 comments on commit e508ace

Please sign in to comment.