Code Sample |
#!/bin/lua -- hello.cxx from the FLTK tutorial in Lua. -- Create a window w = fltk:Fl_Window(300,180,"Hello") -- and a box with the "Hello, World!" string in it: box = fltk:Fl_Box(20,40,260,100,"Hello, World!") -- Next, we set the type of box and the size, font, and style of the label: box:box(fltk.FL_THIN_UP_BOX) box:labelsize(36) box:labelfont(FL_COURIER_BOLD) box:labeltype(FL_SHADOW_LABEL) -- Of course, that's the C++ way. The Lua way: -- box = Box{20,40,260,100,"Hello, World!"; -- box=Boxtype.up, labelsize=36, labelfont=Font.bold+Font.italic, -- labeltype=Labeltype.shadow} -- Finally, we show the window and enter the FLTK event loop: -- w:end_layout() -- ends the layout of the window w:show() -- The resulting program will display the window below. You can quit -- the program by closing the window or pressing the ESCape key. |