How to get informations from entity in cl_init.lua?
0 replies, posted
Hello,
In my cl_init.lua, I'm trying to get a network var value.
[CODE]
cl_init.lua
--
net.Receive( "OpenNP", function( len, ply )
local frame = vgui.Create("DFrame")
frame:SetSize(520,420)
frame:SetTitle(self:GetNPTitle())
frame:Center()
frame:SetVisible(true)
frame:MakePopup()
end )
[/CODE]
[CODE]
shared.lua
--
function ENT:SetupDataTables()
self:NetworkVar( "String", 0, "NPTitle" );
end
[/CODE]
When "self:GetNPTitle()" is in the ENT:Draw() function, all works fine, but in a net.receive function, I get this error :
[CODE]attempt to index global 'self' (a nil value)[/CODE]
My question is, how to define the entity when not in a "ENT:" function?
(btw sorry for my poor grammar, english isn't my native language)
Sorry, you need to Log In to post a reply to this thread.