monday Posted May 6, 2015 Share Posted May 6, 2015 Hi, at the begining of my script (outside of any function) I use something like: GREEN_COLOR = "#4ED451" RED_COLOR = "#D4644E" Is this being read all the time or only once? I'm wondering if it would be more efficient to put it in a function called upon loggin in. Link to comment
Tete omar Posted May 6, 2015 Share Posted May 6, 2015 All global variables are always accessible through any file with the same type (server/client) as the file they were defined into. Putting them in a function will just define them as if they were "new" upon function call (unless you localize them, so they're accessible only within the function's scope). It's also notable that you cannot access any variable from another resource. Instead, you can always use call or "exports" table. Anyways, i think you need to learn the basics of Lua variables or the basics of Lua if needed. http://www.lua.org/pil/1.html (Getting Started) http://www.tutorialspoint.com/lua/index.htm (Recommended) http://www.lua.org/pil/4.2.html (Local Variables and Blocks) http://lua-users.org/wiki/ScopeTutorial (Scope Tutorial) Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now