Lua json bug

Discussion in 'Rust Development' started by Norn, Aug 14, 2015.

  1. Anyone getting a bug where if they use the item name say "lock.code" (anything with a . in it) then it appears as
    Code:
         "lock": {
            "code": 3
          }
    (3) being the amount

    what it looks like:

    Code:
    { ["lock.code"] = 3, ["apple"] = 5, ["can.tuna"] = 3 }
    
    What it's meant to look like in JSON:

    Code:
    {
          "lock.code": 3,
          "apple": 5,
          "can.tuna": 3
        }
    
    [DOUBLEPOST=1439565911,1439526034][/DOUBLEPOST]Bump, anyone?
     
  2. Lua uses "." as path seperator for tables, so every string containing dots will be split up, try to not use it as key or replace the dots...
     
  3. What's a work around? I don't want to have to make people put incorrect names in the config file just for it to work
     
  4. Wulf

    Wulf Community Admin

    The plugins would have to be updated to store as values instead of keys, else rewritten in C#.
     
  5. Do you have a link to information on json inside this context? I've never used it before rust
     
  6. Wulf

    Wulf Community Admin

    Not on hand, but a search for "storing json value" should come up with something. I'll post an example when I get a chance to update one of my plugins.
     
  7. Good stuff, thanks man