ID:2320439
 
Resolved
The world.vars and global.vars lists did not behave like proper lists.
BYOND Version:512.1395
Operating System:Windows 7 Ultimate 64-bit
Web Browser:Chrome 63.0.3239.70
Applies to:Dream Daemon
Status: Resolved (512.1396)

This issue has been resolved.
Descriptive Problem Summary:
Byond barely considers global.vars a list, (the same seems to be true for world.vars). basically for (var/thing) works on it, and [] works on it, thats it. For reference, everything here works properly on datum's vars list.

Compile time it has no list vars
/client/verb/checkglob()
world << "[global.vars.len]"
world << "[global.vars.Join(", ")]"


loading 512testing.dme
512testing.dm:2:error: global.vars.len: undefined var
512testing.dm:3:error: global.vars.Join: undefined proc
512testing.dmb - 2 errors, 0 warnings (12/2/17 1:30 pm)


The proc ways of doing the same thing flat out don't work
/client/verb/checkglob()
world << "[length(global.vars)]"
world << "[istype(global.vars, /list)]"
world << "[jointext(global.vars, ", ")]"


runtime error: bad text or out of bounds
proc name: checkglob (/client/verb/checkglob)
source file: 512testing.dm,4
usr: Guest-755797302 (/mob)
src: Guest-755797302 (/client)
usr.loc: null
call stack:
Guest-755797302 (/client): checkglob()
0
0



Here's a fun one:

/client/verb/checkglob()
var/list/L = global.vars
world << L.len


Guess what this will do!


.
.
.
.
.




Lummox, I think you might already know what this is going to say, because here is when I realized what you did to make global.vars work (midway thru typing this).

runtime error: Global var len does not exist.
proc name: checkglob (/client/verb/checkglob)
source file: 512testing.dm,3
usr: Guest-755797302 (/mob)
src: Guest-755797302 (/client)
usr.loc: null
call stack:
Guest-755797302 (/client): checkglob()


To anybody who missed it, global.vars is just a reference to global to make it work as a list, lummox just implemented a [] operator overload on it. indeed you can do global.vars:someglobalvar and it will work.

This might not be easily fixable since it really shows a shortcoming of the [] operator overload, there is no way to get a length. (nor is there a way to check that an [] operation would be valid on a thing)

Thanks. I'll look into this Monday.
BTW, global.vars is not a reference to global. It's actually a special type.
BTW, global.vars is not a reference to global. It's actually a special type.

[21:50:42] <%MrStonedOne> !dm global:vars:EAST
[21:50:44] <+Bot32> TheAlmightyStoner: 4
[21:51:16] <%MrStonedOne> !dm var/list/L = global.vars;; L:EAST
[21:51:17] <+Bot32> TheAlmightyStoner: 4
Extra points round:

[21:55:03] <%MrStonedOne> !dm global == global.vars
[21:55:04] <+Bot32> TheAlmightyStoner: runtime error: BYOND Error: bad instruction: 65499; proc name: dm eval (/proc/dm_eval); usr: (src); src: null; call stack:; dm eval(); world: New()


for context, statements that don't have a double ;; are placed inside a world.log << "[statement]" line by the bot
It appears you're hitting an error in the compiler with global == global.vars, since global isn't a real object and shouldn't actually be able to compile as such.
Lummox JR resolved issue with message:
The world.vars and global.vars lists did not behave like proper lists.
As a result of the fix to this issue, global.vars.varname will no longer work. It wasn't really ever intended to; that was a method of handling the fact that there is no global object to read/write vars from. But I've changed that internally.