Skip to content

idiomatic table initialization? #475

Answered by hugomg
JLPLabs asked this question in Q&A
Discussion options

You must be logged in to vote

The most idiomatic is something like you did: a table constructor that holds all the relevant fields.

Pallene doesn't like building tables incrementally. In Lua, one thing that is sometimes done is start with an empty table and then set each field using assignment statements. However, in Pallene that kind of thing isn't easy to do, because Pallene doesn't allow assignment statements to change the type of a table.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@JLPLabs
Comment options

Answer selected by JLPLabs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants