Debriefing > Questions, Help, & How To's
Read Me
Slinky:
Hi, what's the working directory for running lua scripts? I'm trying to put some reusable logic into a separate script so I can use it for later game types. Unfortunately, no matter where I put the included file, when I try to use, "dofile(gamecycle.lua)" to include it, I get a message in the console saying that there is no such file or directory as gamecycle.lua. Is there any solution for this?
Mark [lodle]:
i dont think we support that as i have never had to use it. If you show me your script i can debug it and make it work. :P
Slinky:
The script was pretty simple because I was just trying to get this working before stepping into the whole thing:
In eliminatio.lua:
--- Code: ---
dofile("gamecycle.lua");
function Think()
TestFunc();
end
--- End code ---
In gamecycle.lua:
--- Code: ---
function TestFunc();
ClientPrintAll(HUD_PRINTCENTER, "TEST");
end
--- End code ---
Mark [lodle]:
Ill give it ago tomorrow.
killermonkey:
Try using loadfile(filename)
Make sure the file is in the same directory as the current LUA script. If this doesn't work, try putting the lua file that you want to load in:
....\steam\steamapps\_STEAMNAME_\Source SDK Base 2007\ just for shits and giggles and see if it loads...
Then try putting it in the base directory of the mod (gesource) and try it again. The thing I am trying to get you to test is to see where the entry point of loading files is located. Since we bind LUA to source there are MANY entry points, I am not sure that we define any specific directory as a load point and there is no documentation on dofile or loadfile that describes how LUA handles the entry point...
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version