nut - brianhang/nutscript2 GitHub Wiki

nut

The NutScript 2 framework will provide a table called nut which holds all of the information for the framework in one place so everything is organized.

Libraries

Libraries are groups of related functions that provide a specific functionality. By default, NutScript provides some basic libraries that should get you started on your roleplay gamemode.

Name Description
nut.char A system for storing roleplay information for players.
nut.chat A system for having different modes of communication.
nut.command A system for creating chat and console commands.
nut.currency A system that allows for currency for characters.
nut.data Provides an easy way store and access arbitrary data for a server.
nut.db Provides access to a database for accessing and storing data.
nut.item Provides an interface for an inventory/item system and handles loading items.
nut.team A system for having characters separated into certain teams.
[nut.plugin]]](/brianhang/nutscript2/wiki/Handles-the-loading-and-use-of-[[plugins Plugins).
nut.util Provides some utility functions.

Classes

NutScript provides some classes that are used around the framework to make life easier by keeping related data together (see object oriented programming). You may be familiar with objects in Garry's Mod through stuff such as entities or weapons.

Name Description
Character Characters are profiles within a roleplay gamemode. This stores information such as money, name, model, etc...
Item Items are objects that are stored in inventories and can be used to do certain actions.
Inventory Inventories are containers for items that belong to characters.

Hooks

In order to allow further customization, hooks are used. Hooks allow for your own code to be ran when something happens in a clean way, rather than changing the framework itself. You should not need to change the framework code as it may change in the future so your work could be lost.

Notes

  • Before using DeriveGamemode("nutscript"), you can set NUT_BASE to be a string containing which gamemode NutScript should derive from. So, having NUT_BASE = "sandbox" will include Sandbox features.