Jump to content

How to pass variables between scripts? (Lua)


bansama
 Share

Recommended Posts

Using local before the variable name ensures it's not a global, right? If such a variable is passed with self:FunctionName (variable) does it remain non-global?

 

Yes. Passing variables to functions does not change it's scope. However in the case you had you didn't have local in front of PlayerEnt. So unless above in that function you had: local PlayerEnt, and just didn't show us that code, PlayerEnt would have been global because you just had: PlayerEnt = entity

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...