Local object vars inaccessible in static var declaration
See original GitHub issueWhen attempting to compile /vg/station, the following error occurs:
Error at code\game\machinery\atmoalter\canister.dm:128:14: Unknown identifier "icon"
at the following location:
126 /obj/machinery/portable_atmospherics/canister/proc/pressure_overlays(var/state)
127 var/static/list/status_overlays_pressure = list(
128 image(icon, "can-o0"),
129 image(icon, "can-o1"),
130 image(icon, "can-o2"),
131 image(icon, "can-o3")
132 )
133
134 return status_overlays_pressure[state]
It seems that it doesn’t recognize it’s own icon as a var, or else it’s conflicting with the fact that the first arg of image() is also called icon, or something.
Issue Analytics
- State:
- Created a year ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
static member variable inside a local class in c++?
I'd give up pretty quickly :) No access to local variables from local class: because class instance might outlive the function scope. Example:...
Read more >6.10 — Static local variables
In this lesson, we'll explore the use of the static keyword when applied to a local variable. Static local variables.
Read more >C++ Tutorial: Static Variables and Static Class Members
A variable declared static within a module (but outside the body of a function) is accessible by all functions within that module. However,...
Read more >How do I make a variable accessible across my project?
I need a variable that will be accessible from my main target, and an imported Framework. A Global Variable doesn't work as it's...
Read more >Static Keyword - Manual
Because static methods are callable without an instance of the object created, the pseudo-variable $this is not available inside methods declared as static....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Yes, that’s exactly it.
It’s the same way in BYOND, it just silently errors and treats it as
nullYes, pretty much. It might be helpful to have the error message give more information in the specific case of accesses in static var initialization, but if that’s not simple to implement it seems fine as-is.