Calling a function from another document

Hi all, 

I know there are already questions on this, and tutorials, but for the life of me, I cannot get it to work in the latest version of Corona. Here is my exact code:

–Main Lua

local test = require(“testfile”);

test.printFunction();

–Testfile lua

local M = {};

function printFunction()

end

Hi @mythrialproductions,

Are you sure that everything is a case-sensitive match? Meaning, is the module name actually “testfile.lua” and not"Testfile.lua"? Also, are you return-ing the module’s “M” table, and including your “printFunction()” function within it? It should look something like this:

[lua]

local M = {}

function M.printFunction()

    print( “printFunction() called!” )

end

return M

[/lua]

Hope this helps,

Brent

Hi @mythrialproductions,

Are you sure that everything is a case-sensitive match? Meaning, is the module name actually “testfile.lua” and not"Testfile.lua"? Also, are you return-ing the module’s “M” table, and including your “printFunction()” function within it? It should look something like this:

[lua]

local M = {}

function M.printFunction()

    print( “printFunction() called!” )

end

return M

[/lua]

Hope this helps,

Brent