|
On 11-10-18 10:01 AM, andre@leiradella.com wrote:
Let's say I define 1 function and put it in a file called function.lua, it looks something like this: function silly1() print "reallly long string that greets user" end and define 1 local variable local x = 10 and put it in another file called local.lua.You do realize that in your example x is local but silly1 is global, right? Why don't you declare x as a global? It seems to me that it's what you want. Cheers, Andre
Hi AndreNo I meant them both to be local, it's not real code for anything I want to do. I am just trying to say that if I type local x = 1 in another file and then include it, I would like it become local to where it was included from and not the file it was defined in.
List,I mentioned a function called copy_in in another post and had no replies, likely due to the stupidity of the name. However a function name that described something like this could be used in tandem with require/dofile to break a bigger problem into smaller chunks, by giving different users what they need and again I think that non-programmers should be first in line.
Alternatively perhaps a different file extension would help, a kind of lua header that would define code that is essentially copied in verbatim with no scope effect.
Thanks