Home > Mobile >  why is table.remove and in pairs function both not working in Roblox Studio?
why is table.remove and in pairs function both not working in Roblox Studio?

Time:12-18

I have the following code which Roblox Developer and the Lua.org manual both say should work to remove an instance from the table so I can store as a local, but the local is only holding a nil value.

The table is there. It shows up on the print function. It just will not store to be useful in the app.

I have tried multiple versions of this code including going with just the pairs function, just the table.remove function, and going with and without the position for the table remove, and it all generates nil variable.

    
        response = HttpService:GetAsync(mining)
        data = HttpService:JSONDecode(response, Enum.HttpContentType.ApplicationJson)   
    
local function tprint(t)
        for k,v in pairs(t)  do print(k,v) end 
    end
    tprint(data)
    
    
    local a = table.remove(data, 4)
    local b = table.remove(data, 3)
    local c = table.remove(data, 2)
    local d = table.remove(data, 1) 
    

CodePudding user response:

The solution ended up being so simple, and yet so profound. I can now use this to link crypto, bank accounts, credit cards, and anything else I want directly into Roblox or any other lua based program.

a = (data["result"]["amount"])

  • Related