【发布时间】:2015-01-11 23:01:18
【问题描述】:
内存中有以下内容:(可以直接复制/粘贴到内存选项卡并提交)
{
"creeps": {},
"spawns": {},
"DEBUG": true,
"q": {
"[spawn Spawn1]": [
[
[
"work",
"carry",
"carry",
"move",
"move"
],
"harvester_1",
{
"type": "harvester"
}
],
[
[
"tough",
"attack",
"move",
"move"
],
"guard2",
{
"type": "guard"
}
],
[
[
"work",
"carry",
"carry",
"move",
"move"
],
"harvester_3",
{
"type": "harvester"
}
],
[
[
"ranged_attack",
"move",
"move",
"move",
"move"
],
"fighter4",
{
"type": "ranged_fighter"
}
],
[
[
"heal",
"heal",
"move",
"move",
"move"
],
"healer5",
{
"type": "healer"
}
]
]
}
}
以下代码返回0:
console.log(Object.keys(Memory.q).length);
很明显 Memory.q 实际上包含对生成位置的引用。
仅记录 (Memory.q) 输出 [Object object] 引用,所以我知道它存在于某处。
我错过了什么?还是这只是被窃听了?
【问题讨论】:
-
当我尝试它时会记录
1。不过,[spawn Spawn1]是一个非常奇怪的键名。 -
等等,它对你有用吗?什么...
-
这个内存对象在搞乱我的大脑。
标签: javascript screeps