Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Lua Require function on a full path name

Tags:

path

require

lua

I need to call the require on a lua file that will not always be in the same place. I was trying to call require on the full path name but that doesn't seem to be working either. I even tried replacing one of my working normal requires with a correct full path name to the same file

example changing require "foo" to require "C:\Users\Me\MyLuaProject\foo"

but when i switched it to the full path name it could no longer find it. So I am wondering if you can even call require on a full path and if not how would i achieve the same result differently?

like image 578
George Eric Oliver Avatar asked Aug 08 '12 16:08

George Eric Oliver


1 Answers

If you just need to load a file, use dofile, which takes a path:

dofile("C:\\Users\\Me\\MyLuaProject\\foo")
like image 168
lhf Avatar answered Sep 17 '22 15:09

lhf