• Module Not Loading
    8 replies, posted
here is mah code : [LUA] local meta = FindMetaTable("Player") function meta:UserGroup() return self:GetNetworkedString( "UserGroup" ) end module("Authentication", package.seeall ) local info = { } info.path = "Auth.txt" info.Protocol1 = "Change this please" // Prime password, change this, then change it by lua for security info.Protocol2 = info.path info.Author = "Ningaglio and Meisno" info.Date = "8th of may, 2010" info.info = [[ Use this to add custom groups in a new wayit is very beta, i should even call it pre-alphaso don't get your hopes up yet.]] info.Usage = [[ Authentication.ChangePath changes the location of the users file Authentication.ChangePass is for more security Authentication.Reload is to reload the users file without needing a restart ( useful fo busy servers ) Authentication.Save is a failsafe incase you crash and stuff ( for downgraded admin mods ) ]] hook.Add("Initialize", "AUTH_Info", function() for k,v in ipairs( info ) do print( k .. " : " .. v) end end) local SteamIDs = {} function ChangePath( path ) info.path = path if Call then Call.Prime( "AUTH_PathChanged", path ) end end function ChangePass( def , new ) if def == info.Protocol1 then info.Protocol1 = new if Call then Call.Prime( "AUTH_PassChanged", new ) end end end function Reload( a, b, c ) local pass = c[1] if pass == info.Protocol1 then local UsersKV = KeyValuesToTable( file.Read( "../"..info.path ) ) for group, tab in pairs( UsersKV ) do for name, steamid in pairs( tab ) do SteamIDs[ steamid ] = {} SteamIDs[ steamid ].name = name SteamIDs[ steamid ].group = group end end if Call then Call.Prime("AUTH_UsersReloaded") end end end concommand.Add("Authentication_ReloadUsers", reload ) hook.Add("PlayerInitialSpawn", "ReloadStuff", function( ply ) local steamid = ply:SteamID() ply:SetUserGroup( SteamIDs[ steamid ].group ) end) function Save( a, b, c) local pass = c[1] if pass == info.Protocol1 then local UsersKV = TableToKeyValues( SteamIDs ) file.Write( "../"..info.path , UsersKV ) end end hook.Add("ShutDown", "FailSafe", function() save( nil, nil, info.Protocol1 ) end) if Call then Call.Add("AUTH_PathChanged","AUTH_PathChanged", function() print( "info.path has been change to" info.path ) end) Call.Add("AUTH_PassChanged","AUTH_PathChanged", function() print( "info.Protocol1 has been change to" info.Protocol1 ) end) Call.Add("AUTH_UsersReloaded","AUTH_PathChanged", function() print( "Users of the Authentication Module have been reloaded" ) end) end if Call then Call.Prime("AUTH_Loaded") end print("The Authentication module loaded") [/LUA] Call is enougher module that words, so its not that i used part of garrys code and yes, i am 'requiring' the module in 'init_menu.lua' in includes and also 'init.lua' also in includes anything wrong?
Lua is case sensitive, You have defined a function called Save, but are calling save. You have also defined a function called Reload but you are passing a function called reload to concommand.Add.
okai, fixed those, now for the test [editline]05:40PM[/editline] [CODE] autorun/server/testl.lua:4: attempt to index global 'Authentication' (a nil value) [/CODE] [editline]05:41PM[/editline] [LUA] require("Authentication") concommand.Add("testAUTH", function() Authentication.Save() end) [/LUA]
Look for any other errors in your console about your module.
no errors, no nothing. this is myt whole console [CODE] Dropped [UK|CG] Meisno from server (Disconnect by user.) Unknown command "sv_rollangle" Unknown command "sv_unlag_fixstuck" Lua initialized (Lua 5.1) LuaGetfile: Not Loading autorun/test server.lua Couldn't include file 'autorun/test server.lua' (File not found) loaded debug stuff includes/modules/Authentication.lua:102: ')' expected near 'info' ERROR! Module 'Authentication' not found! |-------| LOADING ADMIN MOD |--------| | | | LOADED BAN PLUGIN | | LOADED KICK PLUGIN | | LOADED CEXEC PLUGIN | | LOADED GOD PLUGIN | | LOADED PUSH PLUGIN | | LOADED GROUPS PLUGIN | | LOADED SKICK PLUGIN | | LOADED SLAP PLUGIN | | LOADED SLAY PLUGIN | | LOADED GOTO PLUGIN | | LOADED SEND PLUGIN | | LOADED CLOAK PLUGIN | | LOADED BRING PLUGIN | | LOADED FREEZE PLUGIN | | LOADED MOTD PLUGIN | | LOADED ROCKET PLUGIN | | LOADED SPEED PLUGIN | | LOADED CODED BANS PLUGIN | | LOADED IGNITE PLUGIN | | LOADED PUNISHEMENTS PLUGIN | | LOADED P-P PLUGIN | | | |-------------------------------------| Registering gamemode 'lobby' derived from 'base' ScriptEnforce is disabled entities\snoc_citizen\cl_init.lua:18: chunk has too many syntax levels |------| LOBBY |-------| | BY NINGAGLIO | | | | LOADED | | | |----------------------| Executing listen server config file Hook 'SpawnScoreboard' Failed: entities\text\spawn.lua:19: bad argument #1 to 'SetPos' (Vector expected, got nil) exec: couldn't exec listenserver.cfg InitFastCopy: only 51% fast props. Bug? Lua initialized (Lua 5.1) Couldn't include file 'client/shoppanel.lua' (File not found) LuaGetfile: Not Loading autorun/test server.lua Couldn't include file 'autorun/test server.lua' (File not found) autorun/client/advert2.lua:6: ')' expected near 'advertising' Warning: vgui.Create failed to create the VGUI component (DFrame) autorun/client/devpanel.lua:6: attempt to index global 'devpanel' (a nil value) Registering gamemode 'lobby' derived from 'base' entities\snoc_citizen\cl_init.lua:18: chunk has too many syntax levels Error: Material "models/spawn_effect" : proxy "TextureScroll" unable to initialize! Sending 298 'User Info' ConVars to server (cl_spewuserinfoconvars to see) Initializing render.AddBeam exploit script - By Grea$eMonkey Console Command Syntax: sv_breakclientgraphics "steamid_or_name" numIterations The more iterations performed, the more messed up the victim's graphics will be. Be sure you have the steamid/name in quotes, otherwise this won't work! Have fun breaking people's graphics! Attempted to create unknown entity type weapon_grenade! NULL Ent in GiveNamedItem! loaded [UK|CG] Meisno /'s trail Attempted to create unknown entity type weapon_grenade! NULL Ent in GiveNamedItem! Redownloading all lightmaps Timer Error: attempt to call a nil value ] testAUTH autorun/server/testl.lua:4: attempt to index global 'Authentication' (a nil value) [/CODE] [editline]05:44PM[/editline] WAIT, just saw it
[code]includes/modules/Authentication.lua:102: ')' expected near 'info' [/code] [editline]04:45PM[/editline] I saw that straight away. :v: [editline]04:46PM[/editline] You forgot all of your concatenation operators.
how do i fix this? [CODE] ERROR! Module 'Authentication' not found! [/CODE]
Well, you are missing the ones at the bottom, from line 99 onwards. [editline]04:47PM[/editline] Broke my automerge! [editline]04:48PM[/editline] You need to add the concatenation operator between strings when you want to join them.
sorry, didn't see your post, i was already posting hoping for it to merge [editline]05:50PM[/editline] thx, fixed it
Sorry, you need to Log In to post a reply to this thread.