lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


It was thus said that the Great Dirk Laurie once stated:
> 
> Is anybody regularly using the following idiom for temporarily grabbing
> 200 slots for the price of one?
> 
>     (function ()
>        -- code goes here
>     end)()

  I do the following:

	do
	  -- code goes here
	end

for locals that I know I don't want hanging around.  Usually, it's for stuff
like:

	local data

	do
	  local f = io.open("datafile","r")
	  data = f:read("*a")
	  f:close() -- don't really need this, but I like being explicit
	end

	-- code that uses data

  -spc