• Announcement: Lua.org now officially recommends this forum as a meeting place for the Lua community

Lua 'end' syntax (1 Viewer)

225559

Newcomer
Joined
Nov 17, 2020
Messages
3
Reaction score
3
Is there any way to make the Lua end syntax more similar to Ada's end syntax? e.g.: end if, end loop, end Function_Name

I'm currently using comments to emulate the Ada syntax, e.g.:
Lua:
function Get_Max (A, B)
   if (A > B) then
      return A;
   else
      return B;
   end -- if
end -- Get_Max

print (Get_Max (3, 2))

The Ada equivalent is:
Ada:
with Ada.Text_IO; use Ada.Text_IO;

procedure Main
is
    function Get_Max (A, B : Integer) return Integer
    is
    begin
        if A > B then
            return A;
        else
            return B;
        end if;
    end Get_Max;
begin
    Put_Line (Integer'Image (Get_Max (3, 2)));
end Main;

It looks like the Lua syntax was very much inspired by Ada. Hence, I don't understand why they didn't copy the end syntax as well? It makes the code much more readable.
 

dinsdale247

Moderator
Staff member
Community Patron
Creator of WinLua
Joined
Nov 17, 2020
Messages
91
Reaction score
32
Location
Victoria BC
Website
winlua.net
That's definitely a question for the Lua-L mailing list. I'd like to know what the Lua team says.
 

stetre

Member
Rank: I
Joined
Jan 8, 2020
Messages
48
Reaction score
34
Location
Italy
Website
github.com
Lua syntax was more inspired by Modula, according to this paper by the Lua triumvirate: The Evolution of Lua (pdf).

This answers half the question, I think. As for how one could emulate Ada's syntax, I honestly don't see how, but of course this doesn't mean much.
 

dinsdale247

Moderator
Staff member
Community Patron
Creator of WinLua
Joined
Nov 17, 2020
Messages
91
Reaction score
32
Location
Victoria BC
Website
winlua.net
Lua syntax was more inspired by Modula, according to this paper by the Lua triumvirate: The Evolution of Lua (pdf).

This answers half the question, I think. As for how one could emulate Ada's syntax, I honestly don't see how, but of course this doesn't mean much.
Thanks for the link. I had seen that document once before and lost track of it.
 
Top