• Are STOOLs' Lua serverside, clientside, or shared?
    2 replies, posted
I've only recently started scripting Lua for GMod, but one thing that has been really bugging me is the lack of documentation regarding the development of STOOLs, whereas I can find plenty on SWEPs/SENTs/... So, I've started skimming through other people's STOOLs' code and have been noticing patterns. One thing I still can't figure out, however, and this is probably just me being new to the whole GLua thing, is what STOOLs' Lua is treated as. For example, I can't do anything with a player anywhere in my code without generating an error (and yes, I have double-checked the syntax), yet all the STOOLs I've skimmed through were coded in one single Lua file. Now what if I did want to send messages to the player through my tool, for example? How would one go about this? Am I looking over something here?
It is shared. If for instance you try to access a player in the left click toolgun function, you should make sure only the server runs that code. [lua]if SERVER then --your player stuff else --your client stuff end[/lua] CLIENT is also an enumeration.
[QUOTE=Bletotum;40629649]It is shared. If for instance you try to access a player in the left click toolgun function, you should make sure only the server runs that code. [lua]if SERVER then --your player stuff else --your client stuff end[/lua] CLIENT is also an enumeration.[/QUOTE] But LocalPlayer() is a clientside function, for example. I assume that to get the player associated with the client, then, I would have to declare a variable containing the player seperately? [editline]13th May 2013[/editline] Nevermind. Found the player carrying the tool with self:GetOwner(). Thank you. Marking this as solved.
Sorry, you need to Log In to post a reply to this thread.