Irfan Hossain
Irfan Hossain

Reputation: 59

Relative file paths in Lua?

I'm having some trouble using relative file paths in Lua, I'm not sure what the syntax is supposed to be.

If I have something like:

Parent Directory: File1.lua
              |
              |-----> Folder1: script.lua

If I wanted to use script.lua in File.Lua how would I format the dofiles(), require ' ', and filename strings?

Upvotes: 3

Views: 3397

Answers (1)

lhf
lhf

Reputation: 72422

dofile and filename strings can use "Folder1/script.lua".

For require, use require"Folder1.script".

Upvotes: 4

Related Questions