1. Hi, i need to make a tree in my datafile with lua language ?

    ex :

    Code:
    {
      "00000000000000000": {
        "1": {
          "count": 0
        },
        "detected":  true  },
      "00000000000000001": {
        "1": {
          "count": 0
        },
        "detected":  true
      }
    
    thanks
     
  2. Thanks but i got a code with a single line data ...

    How to make a tree ?
     
  3. The example code builds a nested JSON object, not a flat one.
     
  4. The api exemple :
    Code:
    PLUGIN.Title = "aa"
    PLUGIN.Description = "aa"
    PLUGIN.Author = "CrazyDoo"
    PLUGIN.Version = V(0, 0, 1)local Table = "aa"        --Nom du fichier data
    local dataTable = {}   function PLUGIN:Init()
        self:LoadDataFiles()
    endfunction PLUGIN:LoadDataFiles()
       dataTable = datafile.GetDataTable(Table) or {}
    endfunction PLUGIN:OnExplosiveThrown(player, entity)
        local name = player.displayName
        dataTable[name] = true
        datafile.SaveDataTable(Table)
    end
    Json :
    Code:
    {
      "[God] CrazyDoo": true
    }
    Its not tree :s
     
  5. You can simply serialize a nested table. Instead of adding true to the table, try adding a table.
     
  6. @sqroot , I find :

    Code:
        local targetSteamID = rust.UserIDFromPlayer(player)
        if Data[targetSteamID] then return false end
        if Data[targetSteamID] == nil then
            Data[targetSteamID] = {}
            Data[targetSteamID].az = 0
            Data[targetSteamID].aa = false
            table.insert(Data, Data[targetSteamID])
            datafile.SaveDataTable(List)
    
    Its a tree !

    Its resolved.