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

Probably missing something so obvious...

Started by secret6timb1, 06 September 2015 - 01:15 PM
secret6timb1 #1
Posted 06 September 2015 - 03:18 PM
local xx,yy = obj[2],obj[3]
local f1 = project_objects[xx-1,yy]
local f2 = project_objects[xx+1,yy]
local f3 = project_objects[xx,yy-1]
local f4 = project_objects[xx,yy+1]

project_objects and obj are tables by the way.

on line local f1 = project_objects[xx-1,yy] it says ']' expected near ','

Iv stared at this for 5 minutes and dont see anything wrong.

In the lua command I just did

obj = {}
project_objects = {}
xx,yy = 0,0
local f1 = project_objects[xx-1,yy]

f1 should just be nil but it still says ] expected near ','. I must be stupid if I'm missing something.

EDIT : Sorry, Delete this thread, I meant to put it like [xx-1..','..yy]

I'm stupid o.e.
Bomb Bloke #2
Posted 06 September 2015 - 03:18 PM
Is "project_objects" a function you wish to call?:

local f1 = project_objects(xx-1,yy)

… or a table with a sub-table you wish to index?:

local f1 = project_objects[xx-1][yy]