LUA HELP

Hi i need help please.

I need get all welded entitites but … I cant use GetAllWeldedEntitites
what is wrong in that code?

self.ConWeldTable = Entity in pairs( constraint.GetAllConstrainedEntities( Entity ) )

[editline]1st January 2013[/editline]

Sorry I forgot a couple of line I might fix it.

[editline]1st January 2013[/editline]

self.ConWeldTable = constraint.GetAllConstrainedEntities( Self ) --New table of constrained ents Entity in pairs( constraint.GetAllConstrainedEntities( trace.Entity ) )

for _,i in pairs(self.ConWeldTable) do
	if i.SC_CoreEnt and i.SC_CoreEnt != self.Entity and not string.find(i:GetClass(), "ship_core") then --No more then 1 core per ship
	    Msg("Already a core welded to those props

“)
Msg(”

“)
PrintTable( self.ConWeldTable )
Msg(”==============================

")
constraint.RemoveAll( self )
self.ConWeldTable = {} --Clear the table I guess since odd things were happeneing once in awhile.
return false
end
end

[editline]1st January 2013[/editline]

[ERROR] addons/space combat/lua/entities/ship_core_base/init.lua:189: bad argument #1 to ‘pairs’ (table expected, got nil)

  1. pairs - [C]:-1
  2. CalcHealth - addons/space combat/lua/entities/ship_core_base/init.lua:189
    3. CalcHealth - addons/space combat/lua/entities/ship_core_caldari/init.lua:107
    4. Think - addons/space combat/lua/entities/ship_core_base/init.lua:820
    5. unknown - addons/space combat/lua/entities/ship_core_caldari/init.lua:112

[editline]1st January 2013[/editline]

idea ?

[editline]1st January 2013[/editline]

can i use

self.ConWeldTable = Entity in pairs( constraint.GetAllConstrainedEntities( Self ) ) ?

[editline]1st January 2013[/editline]

nope. :frowning:

[editline]1st January 2013[/editline]

constraint.GetAllConstrainedEntities( ent ) ?

[editline]1st January 2013[/editline]

function constraint.GetAllConstrainedEntities( Self )

self.ConWeldTable = constraint.GetAllConstrainedEntities( Self ) --New table of constrained ents Entity in pairs( constraint.GetAllConstrainedEntities( trace.Entity ) )

end

[editline]1st January 2013[/editline]

thats no working too. Please Help