Question regardling "{".

Hi,

In CBEffect, I saw this code: local kos = CBE.VentGroup{ and was wondering what does it mean. I know a parenthesis after a value means function call but I have no idea what dose the curly brace. My best guess is that it makes a table or something inside VentGroup.

Thanks.

It’s still a function call but passing a table directly as a parameter; so essentially it’s just removing the () braces for us lazy programmers :slight_smile:

I believe I’m right in saying that, hopefully one of the Lua experts will be able to confirm or deny.

No that’s definitely it.

-- This... myCoolFunction{1,2,3,4} -- Is the same as this... mycoolFunction({1,2,3,4})

Lua is super cool and lets you pass a table direct rather than having to use braces on everything. :slight_smile:

You meant parenthesis?

I generally forget the names of all the braces. :wink:

{} can be used in place of ()

doStuff( {1,2,3} ) is the same as doStuff{1,2,3}

[] is a substitute for . in tables

myTable.cool is the same as myTable[“cool”]

That took me some time to understand when I started up, arrays and tables, keys and values and tables inside tables…with syntactic sugar like we´re talking about here

It’s still a function call but passing a table directly as a parameter; so essentially it’s just removing the () braces for us lazy programmers :slight_smile:

I believe I’m right in saying that, hopefully one of the Lua experts will be able to confirm or deny.

No that’s definitely it.

-- This... myCoolFunction{1,2,3,4} -- Is the same as this... mycoolFunction({1,2,3,4})

Lua is super cool and lets you pass a table direct rather than having to use braces on everything. :slight_smile:

You meant parenthesis?

I generally forget the names of all the braces. :wink:

{} can be used in place of ()

doStuff( {1,2,3} ) is the same as doStuff{1,2,3}

[] is a substitute for . in tables

myTable.cool is the same as myTable[“cool”]

That took me some time to understand when I started up, arrays and tables, keys and values and tables inside tables…with syntactic sugar like we´re talking about here