Notice world.setProperty()/world.getProperty() cycle breaks types; all tables become "string" type

Discussion in 'Starbound Modding' started by Supergeek, Oct 17, 2014.

Thread Status:
Not open for further replies.
  1. Supergeek

    Supergeek Scruffy Nerf-Herder

    Maybe I'm just doing it wrong, but I'm trying to save some tables like:

    world.setProperty("mainTable", aSubTable)
    and then retrieving them the same way:

    world.setProperty("mainTable", aSubTable)
    My tables are formed like:

        mainTable.SubTable = {
          [10] = "some string data",
          [15] = "some string data",
          [20] = "some string data",
          [25] = "some string data"
    The numbers are numeric types, not strings. I use them as numerics because I need non-consecutive integer keys. I could do it differently, maintaining a separate index, but that's another discussion. Anyway, before I store them, I check and they are numerics. When I retrieve them back, they're all strings.

    So, just like, a headsup I guess? I can work around it for now by munging them when I import them, but I just wanted you to know.
    severedskullz likes this.
  2. So to be clear... the Keys themselves are being converted from an integer to a string? Certainly interesting. I could be wrong, but I dont think JSON allows you to have an index be a number, which may be why they are being converted into strings during the JSON conversion to the meta-data?
  3. Supergeek

    Supergeek Scruffy Nerf-Herder

    I just chatted with Underbalanced in IRC and he explained to me what a Variant type was. Apparently the devs save the data in setProperty into a variant type which is a generic type, and I guess the modus operandi is to do the heavy lifting on the loading end to interpret the data and set the proper types or whatnot.[DOUBLEPOST=1413506383][/DOUBLEPOST]So I just kludged it to change the index back to numeric when it re-loads the data. But something to keep in mind with getProperty/setProperty I guess.
    Last edited: Oct 17, 2014
  4. Dunto

    Dunto Guest

    Moved to Modding Help.
  5. Why? There is no "Modding Help" needed? He and I are both Modding regulars, and I know he knows enough to know this is nothing he can control at this point and is expressing an issue with the system. This is a nightly bug/issue and was posted in the Nightly Forums as such... Why touch it?
    Supergeek and The | Suit like this.
  6. Supergeek

    Supergeek Scruffy Nerf-Herder

    Yeah... I think getProperty and setProperty are nightly only so far? If that's right, I figured this was relevant to Nightlies only since Stable modders don't really need to hear any of this.
  7. It is. There was no reason to touch it.... It should have stayed where it was.
  8. Dunto

    Dunto Guest

    Your post didn't make it clear that you thought there was a problem with the LUA interpreter in the Nightly build, it looked like you were asking for help with your code, which makes it a modding question. A few things to consider:
    1. The devs are still working on several things in the Nightly builds, it's possible that this may clear up a few days (or weeks) from now once they get it ironed out.
    2. The Nightly builds are not intended to be used for reporting bugs to the devs (as was stated when the Nightly builds were made available).
    3. A more complete working (or non-working, as the case may be) code snippet that can be pasted into a mod file and run (or attempted to be run) will go much further when you ask for help from others (especially if you want to bring this to the attention of someone capable of fixing it).

    The primary reason that the Nightly Support forum exists is to help other users work through an issue, eventually leading to a solution , a workaround, or a confirmed issue that has no current solution. If you feel that this question would help an average Nightly user who may be running into the same trouble, then please feel free to make a new thread in the Nightly Support forum (with your workaround as well since it sounds like you figured a way around it, you can link to this thread for someone to read if they are curious). If the devs do decide to look into it, that's entirely at their discretion, there's no obligation for them to do so.
    • USER WAS WARNED FOR THIS POST. Reason: Losing Your Cool. Expires: 1 Month
    At the very first, I am not the original poster... Pay attention.

    I dont know if you just aren't reading our posts or what... @Supergeek posted very clear, very precise code that generates the issue. Not only that but at the very end of his post:
    How is that asking for help?

    I find this response quite insulting....
    Not only is this a "No Shit" moment, but I specifically was helping you and @Maxwell Demonic in that very specific sub-forum up until you got elected the Support Moderator out of the 3 of us. Perhaps you don't remember that? On the flip side, look under both myself and @Supergeek 's names... You will see the "Magnificent Modder" badge! We have been modding the game since December. We even talk to the developers on an almost daily basis in IRC. We very much know what the nightly is and what it is used for. As well as the Nightly Support Sub-forum. Contrary to your argument, If the subforum was not for Nightly issues/bugs there would no BE a tag specifically for it. Nightly is not supported by the devs and it is a repo that is pushed to the servers every day automatically no matter what the state... again we know this.

    Don't touch topics like this in the future please. It was posted where it belonged.
  9. @severedskullz Just so there's no confusion -- I warned you for losing your cool. Your post would have probably had a better place in being PM'd. If you want to talk about the warning though, please shoot me a message.
  10. Dunto

    Dunto Guest

    @severedskullz: I apologize for the confusion about the post, the initial opening of the post and the fact that someone else told him how to achieve his goal made it look as if he just needed some help to get things working. Since you've tested this and confirmed it's a genuine issue with the Nightly builds, I would suggest that you open a new thread in the Nightly Support forum with this issue and your solution; while the devs have stated that they do not want bugs reported, it can help to have them available in case they do decide to check on the support forums.

    Best of luck to you and Happy Starbounding!
    severedskullz likes this.
Thread Status:
Not open for further replies.

Share This Page