retrieving data from another lua file.

let’s say I am working on  Main.lua…

local Properties = require("objectProperties") --///this is all im wrinting so i dont have to post a crazy amount of lines///-- function createObject(id,damage,objectX) local objectName = id (for example "crate") print(Properties.objectName.id) end

objectProperties.lua

local objectProperties = { ------------------------------------------------------------------- crate = {--START OF CRATE id = "crate", stackable = "no", damage = 50, sprite = { imageSheet = "crateImageSheet.png", imageSheetInfo = "crateImageSheet", sequenceData = { default = { start = "crate\_01", count = 1, loopCount= 1 }, destroy = { start = "crate\_01", count = 7, time = 450, loopCount = 1 } } }, physics = { }, },--END OF CRATE end

I am just trying to access the id in objectProperties, and print it inside of Main.lua

Hi,

Are you returning the ‘propertiesObject’? For example:

[lua]
local objectProperties = 

{

  --== My property tree…

  

}

return objectProperties

[/lua]

Usage:

[lua]
–main.lua

local props = require(‘objectProperties’)

print( props.crate.id )
[/lua]

Hope that helps.

Cheers.

Hi,

Are you returning the ‘propertiesObject’? For example:

[lua]
local objectProperties = 

{

  --== My property tree…

  

}

return objectProperties

[/lua]

Usage:

[lua]
–main.lua

local props = require(‘objectProperties’)

print( props.crate.id )
[/lua]

Hope that helps.

Cheers.