[LUA] How can I run the Script from another lua file?
Hi again, I have some question about LUA. Can I run the function in another lua'sfile in the script? for example: -------------a.lua--------- function main() --load b.lua --run main2() end ------------b.lua----------- function main2() print("main2") end How can make it work? please tell me. Thanks, from Rookie
Quote:
Original post by Rookie_Max
Hi again,
I have some question about LUA.
Can I run the function in another lua'sfile in the script?
for example:
-------------a.lua---------
function main()
--load b.lua
--run main2()
end
------------b.lua-----------
function main2()
print("main2")
end
How can make it work?
please tell me.
Thanks,
from
Rookie
Example:
dofile("b.lua")
main2()
Try reading the manual and PIL from the lua website..
Ad: Ancamnia
Thx a lot: ;)
One more question, Do I need close the file after the function is called?
One more question, Do I need close the file after the function is called?
Quote:
Original post by Rookie_Max
Thx a lot: ;)
One more question, Do I need close the file after the function is called?
No, you don't need to close the file. dofile() just executes the lua script file. I think there are also other ways to include script files but you'll have to see the manual for that.
Ad: Ancamnia
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement