Can I call "createMTE" in multiple places? or should it be only once?

If I’m modularizing my game (composer & object classes etc) is it ok to call “createMTE” in mulitple places.  That is:

 local mte = require("MTE.mte").createMTE()

For example if I’m create the map within my myOwnMap.lua class, but then back in the composer scene with the game loop, can I do this separately here?  (so not actually loading a map twice).  Eg for the game loop:

local mte = require("MTE.mte").createMTE() mte.update()

Each time you call createMTE() you instantiate a completely unique copy of the engine. Any map you’ve loaded into one will not exist in the other. You can get around this two ways; create a global mte variable when your app loads and refer to that, or make mte a child of myOwnMap.lua and call it through that. For example;

myOwnMap.lua:

local M = {} M.mte = require("MTE.mte").createMTE() --The rest of your myOwnMap.lua code return M

Composer Scene:

local myOwnMap = require("myOwnMap.lua") myOwnMap.mte.loadMap("myMap.tmx") --etc

Each time you call createMTE() you instantiate a completely unique copy of the engine. Any map you’ve loaded into one will not exist in the other. You can get around this two ways; create a global mte variable when your app loads and refer to that, or make mte a child of myOwnMap.lua and call it through that. For example;

myOwnMap.lua:

local M = {} M.mte = require("MTE.mte").createMTE() --The rest of your myOwnMap.lua code return M

Composer Scene:

local myOwnMap = require("myOwnMap.lua") myOwnMap.mte.loadMap("myMap.tmx") --etc