Skip to content

GLua library for easily defining preferences and enforcing preferences serverside

License

Notifications You must be signed in to change notification settings

rbreslow/preferences.lua

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

preferences.lua

GLua library for easily defining preferences and enforcing preferences serverside

local preferences = Preferences('myaddon')

preferences:DefineBoolean('feature_enabled', true, function(value)
    print(string.format('feature_enabled changed to: \'%s\'', value))
end)

preferences:SetBoolean('feature_enabled', true) -- Prints: 'feature_enabled changed to: true'

preferences:Get('feature_enabled') -- Returns: (boolean) true

Features

  • Stores tables
  • Built around ConVars
  • Strict type enforcement
  • Enforce values on the server

Installation

Clone the repository into your Garry's Mod addon/gamemode's Lua folder.

On the server, include and AddCSLuaFile the preferences library.

    include('path/to/library/preferences.lua')
    AddCSLuaFile('path/to/library/preferences.lua')

On the client, include the preferences library.

    include('path/to/library/preferences.lua')

About

GLua library for easily defining preferences and enforcing preferences serverside

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages