imageSheet as a variable

I want to perform the following assignments. Build the sheetInfo file and file location string as classLoc and the newImageSheet file and file location string as imageFile using the incoming values className and pngName.

function \_M.spriteRun(spriteType, loops, runTime, x, y, seqName, className, pngName)         print('run ',runTime,' ',x,' ',y,' ',seqName)         local classCon = 'classes.'         local classLoc = classCon..className         local imageCon = '../Images/'         local imageFile = imageCon..pngName         print('spriteRun, classLoc: ',classLoc,' imageFile: ',imageFile)         local sheetInfo = require( classLoc )         local imageSheet = graphics.newImageSheet( imageFile, sheetInfo:getSheet( ) )           local sequenceData = \_M.runSequence(spriteType, loops, runTime, seqName)       local mySprite = display.newSprite( imageSheet, sequenceData ) -- -- execute called sprite --     print('name: ',seqName,' X: ',x,' Y: ',y)     mySprite.isVisible = true     mySprite:setSequence( seqName )     mySprite.x = x     mySprite.y = y     mySprite:play( )    end

Is this possible, if so what is the correct syntax for applying these two variables to the sheetInfo and imageSheet. Bot classLoc and imageFile are being successfully created. So either or both sheetInfo and imageSheet are nil as a result of this assignment.

spriteRun, classLoc:     classes.Coins_Portals     imageFile:     …/Images/Coins_Portals.png

The error that is coming up is:

attempt to index local ‘mySprite’ (a nil value)

Look in your console log and see if there are other messages.

Rob

So here are the rest of the messages from the simulator log:

C:\Users\Documents\VECTORSYS\FFTT_Development\FFTT_Animation\FFTT_Sprites\Debug\main.lua:66: attempt to index local ‘mySprite’ (a nil value)
message
stack traceback:
    ?: in function <?:205>
    [C]: ?
    C:\Users\Documents\VECTORSYS\FFTT_Development\FFTT_Animation\FFTT_Sprites\Debug\main.lua:66: in function ‘coinSequences’
    C:\Users\Documents\VECTORSYS\FFTT_Development\FFTT_Animation\FFTT_Sprites\Debug\main.lua:106: in function ‘_listener’
    ?: in function <?:167>
    ?: in function <?:205>

The other message from the Glider log are from the debugger

FOUND THE ISSUE!, I need a spell checker, miss spelled var about three modules down from this routine. Probably need to learn to type better as well.

Thanks as always for your help

Look in your console log and see if there are other messages.

Rob

So here are the rest of the messages from the simulator log:

C:\Users\Documents\VECTORSYS\FFTT_Development\FFTT_Animation\FFTT_Sprites\Debug\main.lua:66: attempt to index local ‘mySprite’ (a nil value)
message
stack traceback:
    ?: in function <?:205>
    [C]: ?
    C:\Users\Documents\VECTORSYS\FFTT_Development\FFTT_Animation\FFTT_Sprites\Debug\main.lua:66: in function ‘coinSequences’
    C:\Users\Documents\VECTORSYS\FFTT_Development\FFTT_Animation\FFTT_Sprites\Debug\main.lua:106: in function ‘_listener’
    ?: in function <?:167>
    ?: in function <?:205>

The other message from the Glider log are from the debugger

FOUND THE ISSUE!, I need a spell checker, miss spelled var about three modules down from this routine. Probably need to learn to type better as well.

Thanks as always for your help