Reputation: 81
I have the Programming in Lua book and I downloaded the batteries included lua for Windows.
One of the first examples is a function that's saved in a file called lib1.lua. I created this function in the SciTE text editor and saved the file in the directory on my C: drive that contains lua.exe.
But when I type dofile("lib1.lua") in the lua interpreter I get a "no such file or directory". I've looked in several websites and they mention changing the path variable, but they don't say how. Is this a variable in Windows? Or a lua variable somewhere in one of the directories?
Help? Thanks.
Upvotes: 4
Views: 7584
Reputation: 26744
You need to put lib1.lua
into the current folder where the script is being executed or use the absolute path dofile([[c:\path\lib1.lua]])
. In the case of paths on Windows it's better to use [[]]
as string separators as this allows you to not use slash escaping and paths look more "natural".
Upvotes: 7