Search Members Help

» Welcome Guest
[ Log In :: Register ]

Mini-ITX Boards Sale, Fanless BareBones Mini-ITX, Bootable 1G DSL USBs, 533MHz Fanless PC <-- SALE $200 each!
Get The Official Damn Small Linux Book. DSL Market , Great VPS hosting provided by Tektonic
Pages: (2) </ 1 [2] >/

[ Track this topic :: Email this topic :: Print this topic ]

reply to topic new topic new poll
Topic: Lua functions and other bits< Next Oldest | Next Newest >
u2musicmike Offline





Group: Members
Posts: 149
Joined: April 2006
Posted: Feb. 12 2007,03:39 QUOTE

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.
Back to top
Profile PM 
mikshaw Offline





Group: Members
Posts: 4856
Joined: July 2004
Posted: Feb. 12 2007,03:55 QUOTE

You just need to add "Fl:run()" to the end of the script

--------------
http://www.tldp.org/LDP/intro-linux/html/index.html
Back to top
Profile PM WEB 
u2musicmike Offline





Group: Members
Posts: 149
Joined: April 2006
Posted: Feb. 13 2007,15:31 QUOTE

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.
Back to top
Profile PM 
mikshaw Offline





Group: Members
Posts: 4856
Joined: July 2004
Posted: Feb. 13 2007,18:16 QUOTE

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.


--------------
http://www.tldp.org/LDP/intro-linux/html/index.html
Back to top
Profile PM WEB 
8 replies since Feb. 09 2007,04:29 < Next Oldest | Next Newest >

[ Track this topic :: Email this topic :: Print this topic ]

Pages: (2) </ 1 [2] >/
reply to topic new topic new poll
Quick Reply: Lua functions and other bits

Do you wish to enable your signature for this post?
Do you wish to enable emoticons for this post?
Track this topic
View All Emoticons
View iB Code