Summary

Functions

Returns a library table, creating it if it does not exist.
Creates a library table, or returns it if it already exists.
Creates a class table that can be called to create instances.

Functions

library.Get(strName, tParent)

shared gamemodes/catwork/gamemode/core/sh_kernel.lua:693

Returns a library table, creating it if it does not exist.

library itself can be called as a shortcut: library('door', cw).

Parameters

  • strName String Name of the library
  • tParent Map optional, defaults to _G Table the library is stored in

Returns

  • Map The library table

See also

library.New(strName, tParent)

shared gamemodes/catwork/gamemode/core/sh_kernel.lua:678

Creates a library table, or returns it if it already exists.

library.New('door', cw) -- creates cw.door

Parameters

  • strName String Name of the library
  • tParent Map optional, defaults to _G Table the library is stored in

Returns

  • Map The library table

See also

library.NewClass(strName, tParent, CExtends)

shared gamemodes/catwork/gamemode/core/sh_kernel.lua:724

Creates a class table that can be called to create instances.

Calling the class creates a new object with the class as its metatable and a copy of its fields, runs the base class (if any) and then the constructor, which is the method named after the class. Constructor errors are printed instead of raised. The class gets ClassName and BaseClass fields.

library.NewClass('CItem', _G)

function CItem:CItem(name)
  self.name = name
end

local item = CItem('Crowbar')

Parameters

  • strName String Name of the class and of its constructor method
  • tParent Map optional, defaults to _G Table the class is stored in
  • CExtends Map optional, defaults to nil Base class whose fields are copied into the class metatable

Returns

  • Map The class table

See also

Defined in