Something like this would pass a code review, while the original would not:
function createObject(value, id, nominal)
return {
value = value,
id = id,
nominal = nominal
}
end
local objects = {
createObject(100, 1, "nominal1"),
createObject(200, 2, "nominal2"),
createObject(300, 3, "nominal3"),
createObject(400, 4, "nominal4")
}
Still far from ideal, but I'm not that familiar with LUA either. And I do acknowledge that bad code can work, and heck, even I write them sometimes. My original point is that it has downsides and risks, and so I don't consider it fine. I have dreaded to touch such code (mine and others) many times, and made mistakes because of past laziness like that, many times.