how to use "dmg:GetDamage()" ?

[LUA]
function GM:EntityTakeDamage( ent, ply, dmg, dmginfo )
if ent:GetClass() == “TEST_ENT” then
ent.VAR = ent.VAR - dmg:GetDamage()
end
end
[/LUA]

ERROR:

[LUA]
[gamemodes*\gamemode*.lua:**] attempt to call method ‘GetDamage’ (a nil value)(Hook: EntityTakeDamage)
[/LUA]

what am i doing wrong?

You are using dmg,and dmg is just a number while dmginfo is the object you want to get the damage amount from.
Also,dmg is actually the damage the entity gets,you don’t need to use the dmginfo:GetDamage() anyway.

ok, how should i do then?

Probably something like this.
[lua]
function GM:EntityTakeDamage( ent, ply, dmg, dmginfo )
if ent:GetClass() == “TEST_ENT” then
ent.VAR = ent.VAR - dmg
end
end
[/lua]
alternatively
[lua]
function GM:EntityTakeDamage( ent, ply, dmg, dmginfo )
if ent:GetClass() == “TEST_ENT” then
ent.VAR = ent.VAR - dmginfo:GetDamage()
end
end
[/lua]

[LUA]
[gamemodes*\gamemode*.lua:***] attempt to perform arithmetic on local ‘dmg’ (a userdata value)(Hook: EntityTakeDamage)
[/LUA]

second one:
[LUA]
[gamemodes*\gamemode*.lua:****] attempt to index local ‘dmginfo’ (a number value)(Hook: EntityTakeDamage)
[/LUA]

You are using 4 arguments,while the hook uses 5,this is why it’s spitting out errors.
The arguments are
[lua]
function GM:EntityTakeDamage( ent, inflictor, attacker, dmg, dmginfo )
end
[/lua]

it worked, thanks