Having an issue with file.Find("<file>", LUA_PATH)) -
2 replies, posted
I'm working on a plugin functionality for a donator perk system for my server, and I'm having some issues, hopefully someone here can help.
[lua]
//
//
// (These are here so each line is in the proper place.)
//
function LoadPlugins()
Msg("Loading plugins...")
for _, name in pairs(file.Find("plugins/*.lua", LUA_PATH)) do
Msg("Loading " .. name .. "...")
if SERVER then
AddCSLuaFile("plugins/" .. name)
end
include("plugins/" .. name)
end
end
LoadPlugins()
[/lua]
That function produces this error:
[quote][ERROR] ...bobdonatorperks/lua/autorun/server/tbob_donatorperks.lua:7: bad argument #2 to 'Find' (string expected, got nil)
[/quote]
[url=https://docs.google.com/document/d/1CIMxhvD7UX1lJPGi_DpDmPdTcVloIDYo-6AAMQl_KCs/edit?pli=1]This document[/url] says:
[quote]If you want to search the Lua paths use LUA_PATH - not in a string.[/quote] However, doing so results in the above error.
Retyping it as a string results in no errors, but it doesn't seem to even run Msg("Loading plugins...")
I'm thoroughly stumped at this point, can anyone help me out?
Thanks in advance!
It was changed to "LUA" near the end of the beta for consistencies sake.
Ah, thanks! Should've known it'd be something simple like that :/
Sorry, you need to Log In to post a reply to this thread.