Sup, I'm have three entities.
item_ammo_revolver_ttt
AddCSLuaFile()
ENT.Type = "anim"
ENT.Base = "ammo_ttt2_pistol_heavy"
ammo_ttt2_pistol_heavy
AddCSLuaFile()
ENT.Type = "anim"
ENT.Base = "ammo_ttt2_base"
ENT.AmmoType = "pistol_heavy"
ENT.AmmoGive = 12
ENT.AmmoMax = 36
ENT.Model = Model("models/items/357ammo.mdl")
function ENT:Initialize()
self:SetColor(Color(255, 100, 100, 255))
self.BaseClass.Initialize(self)
end
and ammo_ttt2_base with the following ran shared
function ENT:Initialize()
self:SetModel(self.Model)
self:PhysicsInit(SOLID_VPHYSICS)
self:SetMoveType(MOVETYPE_VPHYSICS)
self:SetSolid(SOLID_BBOX)
self:SetCollisionGroup(COLLISION_GROUP_WEAPON)
local b = 26
self:SetCollisionBounds(Vector(-b, -b, -b), Vector(b,b,b))
if SERVER then
self:SetTrigger(true)
end
self.PickedUp = false
end
Now, the self.BaseClass.Initialize(self) line in ammo_ttt2_pistol_heavy is giving me this stack overflow error.
[ERROR] stack overflow
1. GetTable - [C]:-1
2. __index - lua/includes/extensions/entity.lua:23
3. Initialize - gamemodes/terrortwo/entities/entities/ammo_ttt2_pistol_heavy.lua:13
4. Initialize - gamemodes/terrortwo/entities/entities/ammo_ttt2_pistol_heavy.lua:13
5. Initialize - gamemodes/terrortwo/entities/entities/ammo_ttt2_pistol_heavy.lua:13
6. Initialize - gamemodes/terrortwo/entities/entities/ammo_ttt2_pistol_heavy.lua:13
7. Initialize - gamemodes/terrortwo/entities/entities/ammo_ttt2_pistol_heavy.lua:13
8. Initialize - gamemodes/terrortwo/entities/entities/ammo_ttt2_pistol_heavy.lua:13
9. Initialize - gamemodes/terrortwo/entities/entities/ammo_ttt2_pistol_heavy.lua:13
10. Initialize - gamemodes/terrortwo/entities/entities/ammo_ttt2_pistol_heavy.lua:13
11. Initialize - gamemodes/terrortwo/entities/entities/ammo_ttt2_pistol_heavy.lua:13
12. Initialize - gamemodes/terrortwo/entities/entities/ammo_ttt2_pistol_heavy.lua:13
13. Initialize - gamemodes/terrortwo/entities/entities/ammo_ttt2_pistol_heavy.lua:13
14. Initialize - gamemodes/terrortwo/entities/entities/ammo_ttt2_pistol_heavy.lua:13
15. Initialize - gamemodes/terrortwo/entities/entities/ammo_ttt2_pistol_heavy.lua:13
16. Initialize - gamemodes/terrortwo/entities/entities/ammo_ttt2_pistol_heavy.lua:13
I've never really experienced a stack overflow error before so I'm wondering if anyone knows what's going on and how to fix it/prevent it from happening again. Thanks.
Do it like the example on this page: http://wiki.garrysmod.com/page/baseclass/Get
Never use self.BaseClass (at least on entities, weapons, or gamemodes)
That was it, thank you!
Sorry, you need to Log In to post a reply to this thread.