Programming and Scripting :: Lua functions and other bits



Can somebody tell me why this doesn't work?

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.

You just need to add "Fl:run()" to the end of the script
Well I was beating my head on the wall over that one.  I just didn't notice the Fl:run was missing and the strange thing was no error message.  I played around with the Hello World program some more and was not able to get the shadow text to work.  I commented out labelfont and labeltype and it didn't make a difference.
Shadow text is not currently available in murgaLua (unless it's just not available in the non-Xft version).

There was no error because there was nothing wrong with your script. The Lua portions of the script still run, but since no Fl:run was included the FLTK portions were not displayed.


original here.