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.
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".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With