wiremod / wire

Garry's Mod add-on that allows users to wire up components in order to make more elaborate automatic and user-controlled contraptions.
http://www.wiremod.com
Apache License 2.0
547 stars 332 forks source link

tables containing functions will break the debugger #3034

Closed ARaccoonNamedDEF closed 3 months ago

ARaccoonNamedDEF commented 3 months ago

When you try to use the wire debugger on an Expression 2 chip that has a table that contains a function, the debugger will break permanently.

Here's an Expression 2 chip I wrote that should reproduce this:

@outputs Table:table

Table = table()

Table["Speak",function] = function() {
    print("Hi")
}

This is the console error I've gotten:

[wire] entities/gmod_wire_expression2/core/table.lua:82: attempt to call a nil value
  1. temp - entities/gmod_wire_expression2/core/table.lua:82
   2. unknown - entities/gmod_wire_expression2/core/table.lua:106
    3. updateForPlayer - addons/wire/lua/weapons/gmod_tool/stools/wire_debugger.lua:298
     4. unknown - addons/wire/lua/weapons/gmod_tool/stools/wire_debugger.lua:328

Timer Failed! [Wire_DebuggerThink][@addons/wire/lua/weapons/gmod_tool/stools/wire_debugger.lua (line 332)]
Denneisk commented 3 months ago

Yeah don't output tables containing functions or functions, or have them in a subtable if you so need them. I believe this is because functions don't have a function for the debugger to represent them as a string.

thegrb93 commented 3 months ago

The debugger should still be fixed to not error

Denneisk commented 3 months ago

Of course, sorry to imply that it shouldn't be fixed. It's just that the usage seems uncommon.