Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

local variables in Perl and Lua

Name: Anonymous 2011-07-22 21:32

I didnt get an answer for this in the Python thread, so I'll ask here: Why do variables have to have the local keyword to make their scope local? Why cant it just use implicit lexical scope like most any other languages?

Name: Anonymous 2011-07-23 3:36

>>19
not the right story. Lua does it this way because it's a data description language. The designers feel that a simple file that just says "height = 50 width = 20" should be useful.

actual Lua code that is written for functionality simple doesn't include globals. It's not hard, and since the global table is a regular table, you can stick a metatable on it that stops you from making globals (for instance)

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List