Topic: scripting dofile error

I have some scene that each of them have a script,
in every script, there's several function that is same each other, so I move them and make a new lua file, then call it with dofile("function.lua") in every script that needed this function.
But it's failed, the function never being called.

A simple test case,
I have 2 scene, let's call them scene A and B,
and I have 3 script, script A for scene A, script B for scene B, and script C is called by script A and B.

for example:

script A wrote:


script C wrote:


The result should be print "test", but it's not happen.
Is this a bug?

Re: scripting dofile error

Hi, sorry, I didn't see this post,
dofile normally don't execute the code inside it,
write a function inside scriptc.lua where you do "print("test")" and call this function in scripta.lua