ID:261529
 
Below is the relevant code...
prog
var
name = ""
proc/exec()
savePage
name = "savePage"
loadPage
name = "loadPage"
system
var/list/runlist = list()
New()
set background = 1
for(var/prog/P in typesof(/prog/))
new P
runlist.Add(P)
world << P.name

The problem is that it acts as if typesof(/prog/) is an empty list, and adds absolutely nothing to runlist!
Lord of Water wrote:
Below is the relevant code...
> prog
> var
> name = ""
> proc/exec()
> savePage
> name = "savePage"
> loadPage
> name = "loadPage"
> system
> var/list/runlist = list()
> New()
> set background = 1
> for(var/prog/P in typesof(/prog/))
> new P
> runlist.Add(P)
> world << P.name
>

The problem is that it acts as if typesof(/prog/) is an empty list, and adds absolutely nothing to runlist!

Why not do new P(src)?
In response to Sariat
Because I want to add it to runlist, not to src. Thanks for your help, though.

-LoW
Lord of Water wrote:
for(var/prog/P in typesof(/prog/))

The problem is that it acts as if typesof(/prog/) is an empty list, and adds absolutely nothing to runlist!

That's because there are no /progs in typesof(/prog/). That for() loop is trying to filter out each /prog instance in a list of types.


for(<font color=#ffffa0>var/P</font> in typesof(/prog/))

should do what you want.
In response to Shadowdarke
The problem with that is that then I can't read prog's name without using the : operator. Is there a way around it?

[Edit] On runtime, using the : operator gives me a cannot read [prog's path].name error. Oops.[/Edit]
In response to Lord of Water
var/prog/P
for(var/Type in typesof(/prog/))
P = new Type()
runlist.Add(P)
world << P.name
In response to Lord of Water
Lord of Water wrote:
Because I want to add it to runlist, not to src. Thanks for your help, though.

-LoW

DUH! *slaps head* Damn, I should read clearer...

*goes off to punch himself*
In response to Shadowdarke
Ah, it works! Thank you much.

-Lord of Water