lua will correctly resolve the function adresses for printLower and printUpper in the choice.functions table in the example below.
choice = { keys = {"j", "J", "C-j"}, functions = { j = printLower, J = printUpper, }}function printLower() celestia:print("Menu choice = J")endfunction printUpper() celestia:print("Menu choice = [Shift]+[J]")endlua will however nót resolve those adresses at all if you do the same thing using a little bit different syntax for the definition of the table.
menu.choice = {}menu.choice.keys = {"j", "J"}menu.choice.functions = {}menu.choice.functions["j"] = printLowermenu.choice.functions["J"] = printUpperfunction printLower() celestia:print("Menu choice = J")endfunction printUpper() celestia:print("Menu choice = [Shift]+[J]")endAlthough In this example exactly the same happens in exactly the same following order, lua will value the printLower and printUpper fields as nil and you will end up with an error when you try to run the script in Celestia.
The second example is in fact correct, since in general lua can't resolve adresses of fields or functions that it hasn't seen yet and expects a following order as shown below.
function printLower() celestia:print("Menu choice = J")endfunction printUpper() celestia:print("Menu choice = [Shift]+[J]")endmenu.choice = {}menu.choice.keys = {"j", "J"}menu.choice.functions = {}menu.choice.functions["j"] = printLowermenu.choice.functions["J"] = printUpper