I am working on a project. flashObjects.lua file has Table T. I am working with showObjects.lua which has Table S. I have require('flashObjects") in the flashObjects.lua file. However, I am unable to retireve the data from T.lua file from flashObjects.lua file.
Error message is attempt to index ‘t’ (a nil value)
stack traceback
Error message is in the image.
This is where I am getting the error from in showObjects…
-- Pulling only 6 frames from original Image Sheet s = {t[1],t[2],t[3],t[4],t[5],t[6]}
--------------showObjects.lua-------------------
local fruitShuffle = require("TableShuffle") local dragFruits = require("dragObject") local fruits = require("fruits") local flashObjects = ("flashObjects") local fruitSheet = graphics.newImageSheet( "fruits.png", fruits:getSheet() ) -- Pulling only 6 frames from original Image Sheet s = {t[1],t[2],t[3],t[4],t[5],t[6]} -- Shuffle 6 frames order from original Image Sheet shuffleTable = shuffle(s) -- Pulling frames from Shuffle table "s" showFruitsSeqData = { {name="S1",sheet=fruitSheet,frames={s[1]} }, {name="S2",sheet=fruitSheet,frames={s[2]} }, {name="S3",sheet=fruitSheet,frames={s[3]} }, {name="S4",sheet=fruitSheet,frames={s[4]} }, {name="S5",sheet=fruitSheet,frames={s[5]} }, {name="S6",sheet=fruitSheet,frames={s[6]} } } -- configure size and placement for each frame store in table data showFruitsData = { {frameIndex=s[1], width=80, height=80, x=50, y=25}, {frameIndex=s[2], width=80, height=80, x=display.contentCenterX, y=25 }, {frameIndex=s[3], width=80, height=80, x=270, y=25 }, {frameIndex=s[4], width=80, height=80, x=50, y=150 }, {frameIndex=s[5], width=80, height=80, x=display.contentCenterX, y=150 }, {frameIndex=s[6], width=80, height=80, x=270, y=150 } } -- Looping the data from the ShowFruitsData Table & enabling objects to to drag for i = 1,#showFruitsData do showFruits = display.newImageRect( fruitSheet, showFruitsData[i].frameIndex, showFruitsData[i].width, showFruitsData[i].height ) showFruits.x=showFruitsData[i].x showFruits.y=showFruitsData[i].y -- Add touch sensitivity to object showFruits:addEventListener( "touch", dragObj ) end
The Table T is in flashObjects.lua
--------------flashObjects.lua-------------------
local fruitShuffle = require("TableShuffle") local dragFruits = require("dragObject") local fruits = require("fruits") local fruitSheet = graphics.newImageSheet( "fruits.png", fruits:getSheet() ) -- Original number of frames from Fruits Image Sheet t = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32} return t -- Shuffle frames from orginal Image Sheet shuffleTable = shuffle(t) fruitSeqData = {name="level", sheet=fruitSheet, frames={t[1],t[2],t[3]}, time=1500, loopCount=1, loopdirection="forward"} flashFruits = display.newSprite(fruitSheet, fruitSeqData ) flashFruits.x = display.contentCenterX flashFruits.y = display.contentCenterY flashFruits:play() transition.dissolve( flashFruits, flashFruits, 1, 1250 )
Any help or guidance will be appreciated.