I was trying to make a module that handled both go and gui objects, and needed to store references to each object. Normally I’d use go.get_id() but this is of course not available for gui scripts, so figured I would use msg.url() instead. I’m getting some strange behaviour and just wanted to check it’s as expected. I’m sure I’ll find another way to do this.
Code:
local test = {}
test["a"] = "string key"
test[go.get_id()] = "go.id key"
test[msg.url()] = "msg url key"
print(test["a"])
print(test[go.get_id()])
print(test[msg.url()])
pprint(test)
Output:
DEBUG:SCRIPT: string key
DEBUG:SCRIPT: go.id key
DEBUG:SCRIPT: nil
DEBUG:SCRIPT:
{ --[[000002640697CB50]]
hash: [/blob] = "go.id key",
a = "string key",
url: [galaxy:/blob#blob] = "msg url key"
}
The above illustrates that you can set a table key as a url (because the data is visible in a pprint), but you can’t directly access the value by specifying the same url as a key.
Any thoughts?