indexed tables for sprite definition

I am trying to write a driver module to handle all of the core sprite processes for my game. I want to be able to have the table names used in the pairs and ipairs loops to be variables rather than ‘hard coded’ tables. additionally I want to have the tables indexed by a type name representing the sprite being called. Here is a test main script. There are areas commented out that are the alternative indexing mentioned above.
local sheetInfo = require( 'classes.Coins\_Portals' ) --WHAT IS WRONG WITH THIS SET OF DECLARATIONS? --spriteParams = {{},{}, {}, {}} --spriteParams = { --    [coins] = { --    {"coins","classes.Coins\_Portals","../Images/Coins\_Portals.png","L1",1,3,"Y","N","static","Y","N"}, --    {"coins","L3","static","Y","N","N","classes.Coins\_Portals","../Images/Coins\_Portals.png","fixedCoins",4,5} } --} --local tableName = "spriteParams" spriteParams = {} spriteParams[1] = {     {"coins","classes.Coins\_Portals","../Images/Coins\_Portals.png","L1",1,3,"Y","N","static","Y","N"},     {"coins","L3","static","Y","N","N","classes.Coins\_Portals","../Images/Coins\_Portals.png","fixedCoins",4,5} } -- Background -- local newBackGround = display.newRect(1500,800,3000,1600) newBackGround:setFillColor(0) local tabId = "coins" local tabId = 1 local spriteType = "static" local spriteX = 450 local spriteY = 600 print("calling params")         x = spriteX         y = spriteY                for i,k in pairs (spriteParams[tabId])do -- tabId works fine as a numerical indexing value        --for i,k in pairs (tableName [tabId])do    -- this however does not        --for i,k in pairs (spriteParams [coins])do -- neither does this           print('pass: ',i)             print('in sprite params, data is: ',k[1], k[2], k[3], k[4], k[5], k[6], k[7], k[8], k[9], x, y, k[10], k[11])             print ("call vals", k[1], k[2], k[3], k[4], k[5], k[6], k[7], k[8], k[9], x, y, k[10], k[11])          end

Items in red/bold at the top of the code are the attempted code used to create a multi-indexed table using string values that identify the base sprite being called.

lower down are two test pair loops one with the table name as a variable string ‘tableName’ and the other using the string value as an index ‘spriteParams[coins]’.

I think I’m close on getting this correct but I am not sure. I figured I would ask someone who would know rather than banging my head on the keyboard.

Hey!

You may want to reformat your post. It’s quite illegible currently.

@tulipkapy

That looks like a lot of code. Please provide a tiny downloadable project demonstrating the problem. Then we can download it, run it, and give feedback.

Giving feedback on big code dumps and out of context code dumps is a bit hard and may not get you the right answer.

PS - Welcome to the forums and community. Sorry you’re having a rough time out of the gate.

PPS - What you’re trying to do is totally possible, so don’t give up.