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 12:38

>>27
I don't think local is too long. It would be if it were like Lisp or C where you had to introduce a new level of indentation on top of it. Every keyword in lua is long. "function" is longer than "lambda" which is longer than "fn" but really who cares? it's just a bit of typing

>>29
You'd have to define Width and Height functions. "height = 50 width = 20" works as the only Lua file. You just grab the values out of the global table, no need to bind or define anything. Just #include "lua.h" (also keep in mind Lua is meant to be embedded. It doesn't have the stuck-up Lisp bullshit of pretending it's running on a Lisp machine with a Lisp OS.)

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