lua-users home
lua-l archive

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


On 25 January 2015 at 08:07, Gordon Madarm <gmadarm@gmail.com> wrote:

Thanks! One follow up question, the documentation uses the httpc:request_pipeline{} syntax, while you use  httpc:request_pipeline(). What is the difference between curly brackets and circle brackets here?
 
-G


The curly braces are just a shortcut for calling a function with a new table as its only argument (though functions called with the colon syntax still receive the object before the colon as their first argument and the table as their second argument). You can also do this with string literals. This is explained in more detail in the manual[1].

This:
httpc:request_pipeline{ ... }

Is equivalent to this:
httpc:request_pipeline({ ... })

And this:
local request = { ... }
httpc:request_pipeline(request)


[1] http://www.lua.org/manual/5.3/manual.html#3.4.10