You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a set of data in key-value pairs that is constant, never changing. I need to access the values by using a variable that holds the key (it's dynamic). It is specific to a subset of code, and I'd like to put it in a namespace that relates to it. I figured that creating a Map was the best way to handle this type of data so I can access the values based off of the key (I've had other issues trying to access values on objects via dynamic keys in AssemblyScript otherwise I would use that). I figured exporting it from the namespace would provide me with what I've needed. I've exported functions from the same namespace without any issues. I am open to other options so if there's an AssemblyScript way to handle this please let me know.
The issue that I am having is that all of the code that I have tried exports an empty map, or doesn't compile. The only way to get it to work is to create a function that returns it, and export that function. I'd like to avoid doing this.
Somehow it cannot find the function declared immediately before it. I've tried other variations on this with no desired results as well.
The version of AssemblyScript that I am using is 0.25.2.
Any ideas how I can accomplish this? I am not sure if it's a bug or if this is an intended consequence of the way AssemblyScript works. As I've said, I'm open to other options, but being unable to use dynamic properties on objects I figured a map would be the way to go - but if there's a better way to model and access the data then I would gladly use that. just let me know.
The text was updated successfully, but these errors were encountered:
Question
I have a set of data in key-value pairs that is constant, never changing. I need to access the values by using a variable that holds the key (it's dynamic). It is specific to a subset of code, and I'd like to put it in a namespace that relates to it. I figured that creating a Map was the best way to handle this type of data so I can access the values based off of the key (I've had other issues trying to access values on objects via dynamic keys in AssemblyScript otherwise I would use that). I figured exporting it from the namespace would provide me with what I've needed. I've exported functions from the same namespace without any issues. I am open to other options so if there's an AssemblyScript way to handle this please let me know.
The issue that I am having is that all of the code that I have tried exports an empty map, or doesn't compile. The only way to get it to work is to create a function that returns it, and export that function. I'd like to avoid doing this.
Here is some example code:
When in instantiate
TestClass
, the following shows up in the console:As you can see, the first three solutions all return an empty map.
I also have
TestNamespaceOther
in the code that doesn't even compile. When left uncommented, and I try to compile it, I get the following result:Somehow it cannot find the function declared immediately before it. I've tried other variations on this with no desired results as well.
The version of AssemblyScript that I am using is 0.25.2.
Any ideas how I can accomplish this? I am not sure if it's a bug or if this is an intended consequence of the way AssemblyScript works. As I've said, I'm open to other options, but being unable to use dynamic properties on objects I figured a map would be the way to go - but if there's a better way to model and access the data then I would gladly use that. just let me know.
The text was updated successfully, but these errors were encountered: