|
Post by noncombat on May 4, 2018 15:54:31 GMT
Hello, hope somebody can help me with this.
I want to use a function from another file.
-- MonsterWarlord.lua local dir = scriptPath();
local useFunc = require(dir.."functionFromOtherFile") useFunc.testing(); -- Should give a toast from testing() function from functionFromOtherFile.lua.
--functionFromOtherFile.lua local function testing()
toast("This comes from another file!");
end
-- Output : [img alt="" style="max-width:100%;" src="https://i.imgur.com/bAJJhMG.png"]
|
|
|
Post by noncombat on May 4, 2018 15:55:00 GMT
Hello, hope somebody can help me with this. I want to use a function from another file. -- MonsterWarlord.lua local dir = scriptPath();
local useFunc = require(dir.."functionFromOtherFile") useFunc.testing(); -- Should give a toast from testing() function from functionFromOtherFile.lua.
--functionFromOtherFile.lua local function testing()
toast("This comes from another file!");
end
I get this error :
|
|
|
Post by Acera Dryd on May 5, 2018 17:45:26 GMT
You have to change your file (functionFromOtherFile.lua) to this:
--functionFromOtherFile.lua
local test = {}
local function test.testing()
toast("This comes from another file!");
end
return test
|
|