Why won't my tracelines work....at all????


caller:SendLua( [[ chat.AddText ( Color(0, 255, 0), “Oven is now turned ON!” ) ]] )

are you serious

[lua]local tr1 = {}
start = self:GetPos()+(self:GetUp()*20)+(self:GetForward()*2.8)+(self:GetRight()*11.5);
endpos = self:GetPos()+(self:GetUp()*24)+(self:GetForward()*2.8)+(self:GetRight()*11.5);
filter = self[/lua]

You’re setting the global start, endpos and filter, instead of putting them inside the table:
[lua]local tr1 = {}
tr1.start = self:GetPos()+(self:GetUp()*20)+(self:GetForward()*2.8)+(self:GetRight()*11.5);
tr1.endpos = self:GetPos()+(self:GetUp()*24)+(self:GetForward()*2.8)+(self:GetRight()*11.5);
tr1.filter = self[/lua]
Same goes for the other traces.

You are defining the tr1-tr4 tables but you aren’t putting startpos and endpos into them.

Replace startpos = (…) with tr1.startpos = (…)

It’s fine for debugging.


caller:ChatPrint(“cheeki breeki”)

hurr durr

In gmod you almost never need to sent strings over network (expect for the chatbox, file transfer and things like that);

why the hell would you need to send a string if the client already know what is in the string, just use [lua]net.Start(“yourentityuse”) net.Send(caller)[/lua]

Again, it’s fine for debugging. And fun fact, ChatPrint networks the string internally, but can’t be coloured.

For the record, I would happily use even

net.WriteTable for debugging. I agree with you that SendLua generally should never be in released code (side note, vanilla gmod uses it a lot), but literally ANY code is fine when debugging as long as it doesn’t affect the thing you’re actually debugging.

I was testing to see if it can toggle. Smh…

[editline]27th February 2017[/editline]

Crap I knew I did something stupid, I’ll check it out.

[editline]27th February 2017[/editline]

Alright thanks!

SendLua is fine if
A) You’re not sending it every tick
B) The string doesn’t change at all

But again, you should use net messages instead

Huh? Does it optimize it? Have you got a source?

No, It just stops it from erroring or exploiting, that’s the only reason why I assumed anyone wouldn’t want to use SendLua every tick or in an expensive setting.

ok everyone, now im getting a new error that i cannot fix, like it is not an error inside of my code?!?!

[ERROR] lua/includes/util.lua:181: attempt to index local ‘object’ (a boolean value)

  1. IsValid - lua/includes/util.lua:181
  2. unknown - lua/entities/oven_cooker/init.lua:75

i updated the init.lua filesa above

If you look at the stack trace you can see it’s actually your code producing the error, i.e.

2. unknown - lua/entities/oven_cooker/init.lua:75

Line being

IsValid(traceFire1.Entity:GetClass() == "oven_pot_debug" )

And it’s caused by the fact

IsValid is only meant to be used on “classes”, e.g. entities, panels, custom tables, etc