I need to execute a Lua script from inside another Lua script. How many ways are there, and how do I use them?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Usually you would use the following:
But you can do this through
require()nicely. Example:foo.lua:
bar.lua:
baz.lua:
qux.lua:
This produces the output:
Notice that you do not use the
.luaextension when usingrequire(), but you DO need it fordofile().More information here if needed.