Meh, I thought it would just be easier to have it, that way it would execute on both client and server when either of them intialized, reducing the amount of coding I would have to do.
Oh, i forgot to mention that my receiver table is actually:
[LUA] GM.Receiver = {} [/LUA]
and @Entoros I changed it to gamemode.Call(“ReceiveTest”, Test) and this is the error it gave me.
Attempt to index global value 'GM' a nil value.
which doesn’t make sense considering GM is a table that is instantiated by default for servers.
Oh but that is also when I run a function trying to print out that sucker to debug.
THIRD Edit: yeah gamemode.call I forgot doesn’t do it at the start >.>
[editline]08:52PM[/editline]
Okay so I re-worked it a little because none of you liked my usage of the GM table, and now it just seemed to not run the AddItem for some reason… Here it is:
[LUA]
local Test = {};
Test.Name = “Testy”;
Test.Test = “Hiya”;
hook.Add(“Initialize”, Test.Name, ReceiveTest, Test)
[/LUA]
no errors, however I’m not 100% sure its calling it, in fact im almost positive it isn’t because of this function
[LUA]
Receiver = {}
function ReceiveTest(Test) Receiver[Test.Name] = Test end
function minitest(ply, cmd, args)
Msg(Receiver[“Testy”].Test);
end
concommand.Add(“mini”, minitest)
[/LUA]
for some reason it keeps sayign that Receiver[“Testy”] was attempted to be indexed but came back as a nil value.