This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Bota's profile picture

nested table problem

Started by Bota, 20 July 2015 - 11:19 AM
Bota #1
Posted 20 July 2015 - 01:19 PM
Im using openccsensors-1.7.5 and ComputerCraft1.74

I have:

read-only table: http://pastebin.com/adiKT15b
scan area table: http://pastebin.com/fGennxHh
scan code: http://pastebin.com/E8LEY8zR
end result: http://pastebin.com/R7hZaNC4

So is it possible after i run the scan code and collect all the data to compare Name with Name from end result and if Name is true(exist) just update Position table(X, Y, Z) and if false(not exist) add Name and Position(X, Y, Z) and search the Name in read-only table and add data to the Name in end result table?
Bomb Bloke #2
Posted 22 July 2015 - 03:41 AM
I'm going to go with "yes", dispite your ambiguity. Compare what "Name" with "Name from end result", etc…?!

Exactly which part are you getting stuck with?
Balthamel #3
Posted 22 July 2015 - 04:00 AM
if v.IsPlayer == true then
if targets[k] ==

the way you are doing this seems odd, i'm not sure why you are storing a variable assignment in the table. Tables in the format
{
{false,0,0,0,thaumcraftthingy,mikita}
}
would work better, you remember which value in the table holds what by using comments then you can use

for keys,value in pairs(table) do --for every set of values in the nested tables
if table[key][1] == true then --if the first value in the nested table for each entry is true this key denotes a player
else
  print(
 
end
end