How can I "require" this?

Hi.  I am not 100% sure what you’re trying to do here and the use of the word sprites in your structure is a bit of a misnomer, but one possible way to organize this data as a module is:

-- save in a file called "spriteData.lua" for this example... -- local walkingGirl = {} walkingGirl.data = { width = 309, height = 494, numFrames = 10, sheetContentWidth = 1545, sheetContentHeight = 988} walkingGirl.sheet = graphics.newImageSheet("sprites/walking-girl.png", walkingGirl.data ) walkingGirl.seq = { name = "walking", start = 1, count = 10, loopCount = 0, loopDirection = "forward"} local meleeGirl = {} meleeGirl.data = { width = 385, height = 477, numFrames = 10, sheetContentWidth = 1925, sheetContentHeight = 954} meleeGirl.sheet = graphics.newImageSheet("sprites/melee-girl.png", meleeGirl.data) meleeGirl.seq = { name = "melee", start = 1, count = 10, loopCount = 0, loopDirection } local m = {} -- I'm not clear what this is m.units = {} m.units.girl = {img = "sprites/girl.png", timeBetweenAtk = 2350} } -- You're not storing sprites in this module, but parts used to make sprites, so I'm changing the -- names a bit from your original request. m.parts = {} m.parts.walking = walkingGirl m.parts.melee = meleeGirl return m

 
Then you could make sprites as follows
 

local sd = require "spriteData" local meleeSprite = display.newSprite( sd.parts.melee.sheet, sd.parts.melee.data ) local walkingSprite = display.newSprite( sd.parts.walking.sheet, sd.parts.walking.data )

This example still sucks though… keep reading below.

I do think however that your original concept was too deep  and was combining unrelated data in a single module.
 
I would do this instead:
 

-- save in a file called "girlParts.lua" for this example... -- local m = {} m.walking = {} m.walking.data = { width = 309, height = 494, numFrames = 10, sheetContentWidth = 1545, sheetContentHeight = 988} m.walking.sheet = graphics.newImageSheet("sprites/walking-girl.png", m.walking.data ) m.walking.seq = { name = "walking", start = 1, count = 10, loopCount = 0, loopDirection = "forward"} m.melee = {} m.melee.data = { width = 385, height = 477, numFrames = 10, sheetContentWidth = 1925, sheetContentHeight = 954} m.melee.sheet = graphics.newImageSheet("sprites/melee-girl.png", m.melee.data) m.melee.seq = { name = "melee", start = 1, count = 10, loopCount = 0, loopDirection } return m

Now assuming you had a similar boy set of art you could do this:

-- save in a file called "boyParts.lua" for this example... -- local m = {} m.walking = {} m.walking.data = { width = 309, height = 494, numFrames = 10, sheetContentWidth = 1545, sheetContentHeight = 988} m.walking.sheet = graphics.newImageSheet("sprites/walking-boy.png", m.walking.data ) m.walking.seq = { name = "walking", start = 1, count = 10, loopCount = 0, loopDirection = "forward"} m.melee = {} m.melee.data = { width = 385, height = 477, numFrames = 10, sheetContentWidth = 1925, sheetContentHeight = 954} m.melee.sheet = graphics.newImageSheet("sprites/melee-boy.png", m,melee.data) m.melee.seq = { name = "melee", start = 1, count = 10, loopCount = 0, loopDirection } return m 

Then you could make sprites as follows
 

local girlParts = require "girlParts" local boyParts = require "boyParts" local meleeGirl = display.newSprite( girlParts.melee.sheet, girlParts.melee.data ) local walkingBoy = display.newSprite( boyParts.walking.sheet, boyParts.walking.data ) -- Yes... I made a little joke there too.

Now I would take this one step further.  Only expose parts you need like this:

 

-- save in a file called "girlParts.lua" for this example... -- local m = {} m.walking = {} local data = {width = 309,height = 494,numFrames = 10,sheetContentWidth = 1545,sheetContentHeight = 988} m.walking.sheet = graphics.newImageSheet("sprites/walking-girl.png", data ) m.walking.seq = { name = "walking", start = 1, count = 10, loopCount = 0, loopDirection = "forward"} m.melee = {} local data = {width = 385,height = 477,numFrames = 10,sheetContentWidth = 1925,sheetContentHeight = 954} m.melee.sheet = graphics.newImageSheet("sprites/melee-girl.png", data) m.melee.seq = { name = "melee", start = 1, count = 10, loopCount = 0, loopDirection } return m

Repeat this small change for boyParts.lua

Then you could make sprites as follows
 

local girlParts = require "girlParts" local boyParts = require "boyParts" local meleeGirl = display.newSprite( girlParts.melee.sheet, girlParts.melee.data ) local walkingBoy = display.newSprite( boyParts.walking.sheet, boyParts.walking.data ) -- Yes... I made a little joke there too.

_ girlParts.lua _   oh the connotations that spring to mind…

See  I made a little joke. :slight_smile:

local boyParts = require "girlParts"

Thanks! I am going to be doing this with dozens if not hundreds of sprites.

>> How would I do this the way you described it?

No offense intended, but your (many) questions rarely get “good” replies, because they’re rarely “good” questions…

Your questions are of the paraphrased form “here is some random code, that won’t even compile, let alone do anything useful, how can I get it to function properly, but in a completely different way?”

I myself usually won’t even bother reading such questions, because most could be answered by simply referring to existing docs, and if the OP can’t be bothered to do that, then I can’t be bothered to do it for them.  Either…

  1.  for Corona-specifics, the Corona docs

  2.  for Lua-specifics, either the reference, the PIL or the wiki

(plus, all of those more-formal resources will be more thorough than anything you’ll get as a forum response)

for instance, here’s everything you should need to know re your original implied question “how to make/use a module”

http://lua-users.org/wiki/ModulesTutorial

I’ll be keeping this in mind when writing my questions. (from now on)   :slight_smile: