Search found 2 matches
- Fri May 27, 2016 1:00 am
- Forum: General
- Topic: Instantiation issue?
- Replies: 4
- Views: 2072
Re: Instantiation issue?
test = {} test.__index = test function test:new(x) local newTest = {} setmetatable(newTest, test) self.x = x return newTest end t1 = test:new(1) t2 = test:new(2) print(t1, t2) print(t1.x, t2.x) The output of the print call is: tables at different addresses 2 2 The addresses of the tables are differ...
- Thu May 26, 2016 12:54 am
- Forum: General
- Topic: Instantiation issue?
- Replies: 4
- Views: 2072
Instantiation issue?
function TiledMap:findPath(startX, startY, endX, endY) openlist = {} closedlist = {} startTile = self:getTile(startX, startY) endTile = self:getTile(endX, endY) table.insert(openlist, startTile) print(startTile.x, startTile.y) ... startTile is always the same as the last call to getTile. So in the ...