lua-users home
lua-l archive

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


> a lot of people use and like that syntactical sugar. It makes certain things 
> cleaner, especially emulating named parameter calls:
> create_box { width = 2, height = 3 }
> as opposed 
> tocreate_box({width = 2 height = 3})

I agree that this is a nice shortcut.  I just don't use it nearly as much as I
use commas.  In in this (contrived) function there are 13 commas.

function test(a, b, c)
   print "note"
   for i,v in ipairs(a) do
       b = {1, 2, 3, "boom", {4,5,6}, }
   end
   return a, b, 15, "ok"
end

My average Lua file has over 200 commas, but I only see a handful of
opportunities to use the create_box { width = 2, height = 3 } syntax.  I'm
trying to optimize by far my largest use case.

- Greg