GM:VariableEdited

From Garry's Mod
Jump to: navigation, search
 GM:VariableEdited( )

Contents

Description

Called when a variable is edited on an Entity (called by Edit Properties... menu)

Arguments

Entity ent

The entity being edited

Arguments

Player ply

The player doing the editing

Arguments

string key

The name of the variable

Arguments

string val

The new value, as a string which will later be converted to its appropriate type

Arguments

table editor

The edit table defined in Entity:NetworkVar

Examples

Example

From base/gamemode/variable_edit.lua

function GM:VariableEdited( ent, ply, key, val, editor )
    if ( !IsValid( ent ) ) then return end
    if ( !IsValid( ply ) ) then return end
    local CanEdit = hook.Run( "CanEditVariable", ent, ply, key, val, editor )
    if ( !CanEdit ) then return end
    ent:EditValue( key, val )
end


Personal tools
Navigation