-- Dies ist ein einzeiliger Kommentar

--[[ Dies ist auch ein Kommentarjedoch geht dieser über mehrere Zeilen

und wird beendet mit ]]

function LuaAppSetupFunction()
     local win = MakeObject("PWindow");
     win.SetProperty("Frame", PRect(100,100,500,400))
     win.SetProperty("Flags", BQuitOnWindowClose)
     win.SetProperty("Title", "LuaGUI")

     local view = MakeObject("PView")
     view.SetProperty("Frame", PRect(0,0,400,300))
     view.SetProperty("BackColor", PColor(224,224,224));
     win.RunMethod("AddChild", {view.id})
    
     local label = MakeObject("PLabel");
     label.SetProperty("Frame", PRect(10, 10, 350, 60))
     label.SetProperty("Text", "Haiku, meet Lua!");
     view.RunMethod("AddChild", {label.id})
 end

Main()
Windowopen(x1,y1,x2,y2, WinInternerName, ExternerName)
View(x1,y1,x2,y2, ViewInternerName, ExternerName)
Label(x1,y1,x2,y2, LabelInternerName, ExternerName, text) 


function Windowopen(x1,y1,x2,y2, WinInternerName, ExternerName)
     local WinInternerName = MakeObject(ExternerName);
     WinInternerName.SetProperty("Frame", PRect(100,100,500,400))
     WinInternerName.SetProperty("Flags", BQuitOnWindowClose)
     WinInternerName.SetProperty("Title", "LuaGUI")
end

function View(x1,y1,x2,y2, ViewInternerName, ExternerName)
 local ViewInternerName = MakeObject(ExternerName)
      ViewInternerName.SetProperty("Frame", PRect(0,0,400,300))
     ViewInternerName.SetProperty("BackColor", PColor(224,224,224));
     WinInternerName.RunMethod("AddChild", {ViewInternerName.id})
end

function Label(x1,y1,x2,y2, LabelInternerName, ExternerName, text) 
     local LabelInternerName = MakeObject(ExternerName);
     LabelInternerName.SetProperty("Frame", PRect(10, 10, 350, 60))
     LabelInternerName.SetProperty("Text", text);
     ViewInternerName.RunMethod("AddChild", {LabelInternerName.id})
end

RunApp("application/x-vnd.dw-LuaGUI", "Main");