C# 클래스 GarrysModLuaShared.util

The utility library.
파일 보기 프로젝트 열기: OmegaExtern/gmod-csharp-binary-module

공개 메소드들

메소드 설명
AddNetworkString ( LuaState luaState, string networkString ) : uint

Adds the specified string to a string table, which will cache it and network it to all clients automatically. Whenever you want to create a net message with net.Start, you must add the name of that message as a networked string via this function. If the passed string already exists, nothing will happen and the ID of the existing item will be returned. NOTE: Due to the way string tables work, it's preferable to call this function as soon as the server starts up, such as in Initialize hook. The string table used for this function does not interfere with the engine string tables and has 2048 slots.

Base64Encode ( LuaState luaState, string stringToEncode ) : string

Encodes the specified string to base64.

CRC ( LuaState luaState, string stringToHash ) : string

Generates the checksum of the specified string.

Compress ( LuaState luaState, string stringToCompress ) : string

Compresses the given string using FastLZ. Use with net.WriteData and net.ReadData for networking.

DateStamp ( LuaState luaState ) : string

Returns the current date formatted like '2015-10-27 20-04-59'.

DecalMaterial ( LuaState luaState, string decalName ) : string

Gets the full material path by the decal name.

Decompress ( LuaState luaState, string compressedString ) : string

Decompresses the given string using FastLZ.

GetPData ( LuaState luaState, string steamId, string name, string @default ) : string

Gets PData of an offline player using their Steam ID.

GetSurfaceIndex ( LuaState luaState, string surfaceName ) : uint

Returns the matching surface index for the surface name.

GetSurfacePropName ( LuaState luaState, uint id ) : string

Returns a name of surfaceproperties ID.

IsModelLoaded ( LuaState luaState, string modelName ) : bool

Checks if the model is loaded in the game.

IsValidModel ( LuaState luaState, string modelName ) : bool

Checks if the specified model is valid.

IsValidProp ( LuaState luaState, string modelName ) : bool

Checks if the specified prop is valid.

IsValidRagdoll ( LuaState luaState, string ragdollName ) : bool

Checks if the specified model name points to a valid ragdoll.

NetworkIDToString ( LuaState luaState, uint stringTableId ) : string

Returns the networked string associated with the given ID from the string table.

NetworkStringToID ( LuaState luaState, string networkString ) : uint

Returns the networked ID associated with the given string from the string table.

NiceFloat ( LuaState luaState, double @float ) : string

Formats a float by stripping off extra zeros and dots.

PrecacheModel ( LuaState luaState, string modelName ) : void

Precaches a model for later use. Model is cached after being loaded once.

PrecacheSound ( LuaState luaState, string soundName ) : void

Precaches a sound for later use. Sound is cached after being loaded once.

RelativePathToFull ( LuaState luaState, string file ) : string

Returns the absolute system path to the file relative to /garrysmod/ folder.

RemovePData ( LuaState luaState, string steamId, string name ) : void

Removes PData of an offline player using their Steam ID.

SetPData ( LuaState luaState, string steamId, string name, object value ) : void

Sets PData for an offline player using their Steam ID.

SharedRandom ( LuaState luaState, string uniqueName, double min, double max, double additionalSeed = 0.0D ) : double

Generates a random float value that should be the same on client and server. NOTE: This function is best used in a predicted hook.

SteamIDFrom64 ( LuaState luaState, string steam64Id ) : string

Given a 64bit Steam ID will return a STEAM_0 style Steam ID.

SteamIDTo64 ( LuaState luaState, string steamId ) : string

Given a STEAM_0 style Steam ID will return a 64bit Steam ID.

TimerCycle ( LuaState luaState ) : double

Returns the time since this function has been last called in milliseconds.

TypeToString ( LuaState luaState, object input ) : string

Converts a type to a (nice, but still parsable) string.

메소드 상세

AddNetworkString() 공개 정적인 메소드

Adds the specified string to a string table, which will cache it and network it to all clients automatically. Whenever you want to create a net message with net.Start, you must add the name of that message as a networked string via this function. If the passed string already exists, nothing will happen and the ID of the existing item will be returned. NOTE: Due to the way string tables work, it's preferable to call this function as soon as the server starts up, such as in Initialize hook. The string table used for this function does not interfere with the engine string tables and has 2048 slots.
public static AddNetworkString ( LuaState luaState, string networkString ) : uint
luaState LuaState Pointer to lua_State struct.
networkString string The string to add to the table.
리턴 uint

Base64Encode() 공개 정적인 메소드

Encodes the specified string to base64.
public static Base64Encode ( LuaState luaState, string stringToEncode ) : string
luaState LuaState Pointer to lua_State struct.
stringToEncode string String to encode.
리턴 string

CRC() 공개 정적인 메소드

Generates the checksum of the specified string.
public static CRC ( LuaState luaState, string stringToHash ) : string
luaState LuaState Pointer to lua_State struct.
stringToHash string The string to calculate the checksum of.
리턴 string

Compress() 공개 정적인 메소드

Compresses the given string using FastLZ. Use with net.WriteData and net.ReadData for networking.
public static Compress ( LuaState luaState, string stringToCompress ) : string
luaState LuaState Pointer to lua_State struct.
stringToCompress string String to compress.
리턴 string

DateStamp() 공개 정적인 메소드

Returns the current date formatted like '2015-10-27 20-04-59'.
public static DateStamp ( LuaState luaState ) : string
luaState LuaState Pointer to lua_State struct.
리턴 string

DecalMaterial() 공개 정적인 메소드

Gets the full material path by the decal name.
public static DecalMaterial ( LuaState luaState, string decalName ) : string
luaState LuaState Pointer to lua_State struct.
decalName string Name of the decal.
리턴 string

Decompress() 공개 정적인 메소드

Decompresses the given string using FastLZ.
public static Decompress ( LuaState luaState, string compressedString ) : string
luaState LuaState Pointer to lua_State struct.
compressedString string String to decompress.
리턴 string

GetPData() 공개 정적인 메소드

Gets PData of an offline player using their Steam ID.
public static GetPData ( LuaState luaState, string steamId, string name, string @default ) : string
luaState LuaState Pointer to lua_State struct.
steamId string Steam ID of the player.
name string Variable name to get the value of.
@default string
리턴 string

GetSurfaceIndex() 공개 정적인 메소드

Returns the matching surface index for the surface name.
public static GetSurfaceIndex ( LuaState luaState, string surfaceName ) : uint
luaState LuaState Pointer to lua_State struct.
surfaceName string The name of the surface.
리턴 uint

GetSurfacePropName() 공개 정적인 메소드

Returns a name of surfaceproperties ID.
public static GetSurfacePropName ( LuaState luaState, uint id ) : string
luaState LuaState Pointer to lua_State struct.
id uint Surface properties ID. You can get it from structure.
리턴 string

IsModelLoaded() 공개 정적인 메소드

Checks if the model is loaded in the game.
public static IsModelLoaded ( LuaState luaState, string modelName ) : bool
luaState LuaState Pointer to lua_State struct.
modelName string Name or path of the model to check.
리턴 bool

IsValidModel() 공개 정적인 메소드

Checks if the specified model is valid.
public static IsValidModel ( LuaState luaState, string modelName ) : bool
luaState LuaState Pointer to lua_State struct.
modelName string Name or path of the model to check.
리턴 bool

IsValidProp() 공개 정적인 메소드

Checks if the specified prop is valid.
public static IsValidProp ( LuaState luaState, string modelName ) : bool
luaState LuaState Pointer to lua_State struct.
modelName string Name or path of the model to check.
리턴 bool

IsValidRagdoll() 공개 정적인 메소드

Checks if the specified model name points to a valid ragdoll.
public static IsValidRagdoll ( LuaState luaState, string ragdollName ) : bool
luaState LuaState Pointer to lua_State struct.
ragdollName string Name or path of the model to check.
리턴 bool

NetworkIDToString() 공개 정적인 메소드

Returns the networked string associated with the given ID from the string table.
public static NetworkIDToString ( LuaState luaState, uint stringTableId ) : string
luaState LuaState Pointer to lua_State struct.
stringTableId uint ID to get the associated string from.
리턴 string

NetworkStringToID() 공개 정적인 메소드

Returns the networked ID associated with the given string from the string table.
public static NetworkStringToID ( LuaState luaState, string networkString ) : uint
luaState LuaState Pointer to lua_State struct.
networkString string String to get the associated networked ID from.
리턴 uint

NiceFloat() 공개 정적인 메소드

Formats a float by stripping off extra zeros and dots.
public static NiceFloat ( LuaState luaState, double @float ) : string
luaState LuaState Pointer to lua_State struct.
@float double
리턴 string

PrecacheModel() 공개 정적인 메소드

Precaches a model for later use. Model is cached after being loaded once.
public static PrecacheModel ( LuaState luaState, string modelName ) : void
luaState LuaState Pointer to lua_State struct.
modelName string The model to precache.
리턴 void

PrecacheSound() 공개 정적인 메소드

Precaches a sound for later use. Sound is cached after being loaded once.
public static PrecacheSound ( LuaState luaState, string soundName ) : void
luaState LuaState Pointer to lua_State struct.
soundName string The sound to precache.
리턴 void

RelativePathToFull() 공개 정적인 메소드

Returns the absolute system path to the file relative to /garrysmod/ folder.
public static RelativePathToFull ( LuaState luaState, string file ) : string
luaState LuaState Pointer to lua_State struct.
file string The file to get the absolute path of.
리턴 string

RemovePData() 공개 정적인 메소드

Removes PData of an offline player using their Steam ID.
public static RemovePData ( LuaState luaState, string steamId, string name ) : void
luaState LuaState Pointer to lua_State struct.
steamId string Steam ID of the player.
name string Variable name to remove.
리턴 void

SetPData() 공개 정적인 메소드

Sets PData for an offline player using their Steam ID.
public static SetPData ( LuaState luaState, string steamId, string name, object value ) : void
luaState LuaState Pointer to lua_State struct.
steamId string Steam ID of the player.
name string Variable name to store the value in.
value object The value to store.
리턴 void

SharedRandom() 공개 정적인 메소드

Generates a random float value that should be the same on client and server. NOTE: This function is best used in a predicted hook.
public static SharedRandom ( LuaState luaState, string uniqueName, double min, double max, double additionalSeed = 0.0D ) : double
luaState LuaState Pointer to lua_State struct.
uniqueName string The seed for the random value.
min double The minimum value of the random range.
max double The maximum value of the random range.
additionalSeed double The additional seed.
리턴 double

SteamIDFrom64() 공개 정적인 메소드

Given a 64bit Steam ID will return a STEAM_0 style Steam ID.
public static SteamIDFrom64 ( LuaState luaState, string steam64Id ) : string
luaState LuaState Pointer to lua_State struct.
steam64Id string The 64 bit Steam ID.
리턴 string

SteamIDTo64() 공개 정적인 메소드

Given a STEAM_0 style Steam ID will return a 64bit Steam ID.
public static SteamIDTo64 ( LuaState luaState, string steamId ) : string
luaState LuaState Pointer to lua_State struct.
steamId string The STEAM_0 style ID.
리턴 string

TimerCycle() 공개 정적인 메소드

Returns the time since this function has been last called in milliseconds.
public static TimerCycle ( LuaState luaState ) : double
luaState LuaState Pointer to lua_State struct.
리턴 double

TypeToString() 공개 정적인 메소드

Converts a type to a (nice, but still parsable) string.
public static TypeToString ( LuaState luaState, object input ) : string
luaState LuaState Pointer to lua_State struct.
input object What to convert.
리턴 string