Loads lua scripts at TTT startup. To use, add lua files to lua/ttt_startup_scripts
.
For example, lua/ttt_startup_scripts/say_hi.lua
:
if SERVER then
print("Hi server!")
else
print("Hi client!")
end
The scripts are run once at TTT initialization, within a pcall
.
The scripts are run in the global environment, with the following extra functions:
getEquipment()
- returns TTT's underlyingEquipment
table (available only toCLIENT
).getOriginalEquipment()
- returns a copy of theEquipment
table as it was before any scripts ran (available only toCLIENT
).getDeathsounds()
- returns TTT's underlyingdeathsounds
table (available only toSERVER
).getOriginalDeathsounds()
- returns a copy of thedeathsounds
table as it was before any scripts ran (available only toSERVER
).lookupInFunc(func, ...)
- looks up a variable available to the specified function. Specify multiple varargs to chain lookups.deepCopy(v)
- makes a deep copy of any value.extendSWEP(weapon_class, tab)
- mergestab
into a SWEP. Note that all calls to this function aftergetEquipment()
orgetOriginalEqipment()
have undefined behavior.