Basic question about variables in LUA

Okay… so here’s a really basic question… I have my code divided into modules. I would expect global variables to be shared across modules but apparently (unless I am doing something wrong) they aren’t. So the only way I can update a variable value that is used in another module is to write a “set variable” method and call that method. Is this correct? Is there a good turtorial out there on how variables are handled across modules?

The reason this has become an issue is that I have code detecting the type of a touch (i.e., tap, swipe up, swipe down) in one module and the result of that determination being used in another module. When I use a function to pass the information between modules it appears that the passing doesn’t always happen fast enough.

Sorry if this is a confused question… I’m in a confused spot right now. ; )

Thanks!
[import]uid: 16901 topic_id: 9894 reply_id: 309894[/import]

Hmm… it appears that I misunderstood how to define a global variable in Lua… I now believe you must preface the variable with _G. so that a variable “score” would be defined as a global by _G.score… I’ll try using that tonight. [import]uid: 16901 topic_id: 9894 reply_id: 36087[/import]