Godot Version
4.5.1
Question
I have no idea what im supposed to do with this warning[Ignore]Line 42 (STANDALONE_EXPRESSION):Standalone expression (the line may have no effect).
4.5.1
I have no idea what im supposed to do with this warning[Ignore]Line 42 (STANDALONE_EXPRESSION):Standalone expression (the line may have no effect).
Please copy-past the line of code that is generating this warning.
For example:
extends Node
var my_var
func _ready() -> void:
my_var
[Ignore]Line 6 (STANDALONE_EXPRESSION):Standalone expression (the line may have no effect).
I have a variable âmy_varâ and put it in the _ready function. This line does nothing, because the variable doesnât get used or changed in any way.
Now the expression isnât standing alone anymore and has an effect:
my_var = "something"
I was just about to post this function:
func my_stand_alone_warning_generator() -> void:
42 + 23
It is just a line of code that has no affect on anything.
The simplist one I could make:
func my_stand_alone_warning_generator() -> void:
0
I raise you this one:
func __():__
Lol. I canât believe that works! Love it.
12 Chars eh? How about 10?
func o():o
I am just copying what you did though. Very clever!
Definitely the shortest possible that involves a whole function.
But take a look at this one:
func o(o):o
It does have one more character but in return it rewards you with an extra warning. Powerful stuff.
![]()
Lol! I think that is the winner!
It generates 4 warnings for me!
[Ignore]Line 139 (STANDALONE_EXPRESSION):Standalone expression (the line may have no effect).
[Ignore]Line 139 (UNTYPED_DECLARATION):Parameter âoâ has no static type.
[Ignore]Line 139 (SHADOWED_VARIABLE):The local function parameter âoâ is shadowing an already-declared function at line 139 in the current class.
[Ignore]Line 139 (UNTYPED_DECLARATION):Function âo()â has no static return type.
PS It is now a new game, not code golf, but âflag golfâ, who can produce the most warnings from the shortest code!
PPS This produces 5 warnings and 0 errors!
func f(f):0
As f is shadowing f!
Oh I totally forgot about type warnings. As a duck typing enthusiast - I have them disabled.
The optimal metric is: unique warnings per character - uwpc. Iâm just not sure if whitespace should be counted or not.
Itâd be interesting to see if uwpc over 0.5 is possible. This important research needs more government funding.
This thread showed me how coders have fun. ![]()
I fixed it for you. ![]()
@warning_ignore(âstandalone_expressionâ, âuntyped_declarationâ, âunused_parameterâ, âshadowed_variableâ)
func o(o):o
Wait: Why does it paste as âoâ?
Lol. Perfect! No errors, no warnings! Now ChatGPT can really learn how to deal with these warnings when it scrapes this page!