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
549 stars 333 forks source link

Simple compiler bug #3130

Open deltamolfar opened 3 weeks ago

deltamolfar commented 3 weeks ago

Describe the bug Compiler bug

To Reproduce Attempt to call nil lambda.

@persist A:function

A()

Expected behavior Verbose error

Error message sv: Expression 2 (generic): Internal error 'addons/wire/lua/entities/gmod_wire_expression2/base/compiler.lua:1884: attempt to index local 'f' (a nil value)' at line 3, char 1

Vurv78 commented 1 week ago

It is intentional to avoid overhead with the nil check since the error is harmless. That would ideally be a compile error since the variable isn't initialized though.

No functions should give you a nil lambda