<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/">
	<channel>
		<title><![CDATA[Murga-Projects Forums - All Forums]]></title>
		<link>http://www.murga-projects.com/forum/</link>
		<description><![CDATA[Murga-Projects Forums - http://www.murga-projects.com/forum]]></description>
		<pubDate>Thu, 29 Jul 2010 12:32:46 -0600</pubDate>
		<generator>MyBB</generator>
		<item>
			<title><![CDATA[Opening HTML Reports]]></title>
			<link>http://www.murga-projects.com/forum/showthread.php?tid=387</link>
			<pubDate>Sat, 10 Jul 2010 16:01:15 -0600</pubDate>
			<guid isPermaLink="false">http://www.murga-projects.com/forum/showthread.php?tid=387</guid>
			<description><![CDATA[Hi,<br />
I plan to write some HTML reports to a file from my murgaLua program and then call the end-users system to open the file in a browser to display the report (for viewing and/or printing). Just wondering how in murgaLua I can open a file using whatever is the default program (in this case a browser) for a specific file type.<br />
Thanks<br />
RogerL]]></description>
			<content:encoded><![CDATA[Hi,<br />
I plan to write some HTML reports to a file from my murgaLua program and then call the end-users system to open the file in a browser to display the report (for viewing and/or printing). Just wondering how in murgaLua I can open a file using whatever is the default program (in this case a browser) for a specific file type.<br />
Thanks<br />
RogerL]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Idle scripting language]]></title>
			<link>http://www.murga-projects.com/forum/showthread.php?tid=386</link>
			<pubDate>Tue, 22 Jun 2010 08:49:42 -0600</pubDate>
			<guid isPermaLink="false">http://www.murga-projects.com/forum/showthread.php?tid=386</guid>
			<description><![CDATA[Reading through lua-l I've come around something interesting: Idle:<br />
http://idle.thomaslauer.com/index.html<br />
Seems to be a bunch of packages around Lua, however only for windows.<br />
It sports GUI, sqlite, JIT (based on LuaJIT 1.15), on-the-fly C compiling through tcc, ... And everything is or under the license of the package containing the code, or some modified version of MIT. Maybe an interesting source for new ideas, or windows-centric stuff?<br />
<br />
regards,<br />
JP]]></description>
			<content:encoded><![CDATA[Reading through lua-l I've come around something interesting: Idle:<br />
http://idle.thomaslauer.com/index.html<br />
Seems to be a bunch of packages around Lua, however only for windows.<br />
It sports GUI, sqlite, JIT (based on LuaJIT 1.15), on-the-fly C compiling through tcc, ... And everything is or under the license of the package containing the code, or some modified version of MIT. Maybe an interesting source for new ideas, or windows-centric stuff?<br />
<br />
regards,<br />
JP]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[New SQLite version in 0.7?]]></title>
			<link>http://www.murga-projects.com/forum/showthread.php?tid=385</link>
			<pubDate>Wed, 05 May 2010 08:38:49 -0600</pubDate>
			<guid isPermaLink="false">http://www.murga-projects.com/forum/showthread.php?tid=385</guid>
			<description><![CDATA[Hi,<br />
I was wondering, will there be a new version of sqlite in the upcoming 0.7 release?<br />
Their site says:<br />
<br />
Quote:Version 3.6.23.1 of SQLite is recommended for all new development. Upgrading from version 3.6.12, 3.6.13, 3.6.22, and 3.6.23 is optional. Upgrading from all other SQLite versions is recommended.<br />
<br />
<br />
And judging by http://sqlite.org/changes.html it seems there have been a lot of changes since the 2005 December 19 3.2.8 release included in murgaLua 0.6.9.<br />
<br />
Greetings,<br />
<br />
Jan-Pieter]]></description>
			<content:encoded><![CDATA[Hi,<br />
I was wondering, will there be a new version of sqlite in the upcoming 0.7 release?<br />
Their site says:<br />
<br />
Quote:Version 3.6.23.1 of SQLite is recommended for all new development. Upgrading from version 3.6.12, 3.6.13, 3.6.22, and 3.6.23 is optional. Upgrading from all other SQLite versions is recommended.<br />
<br />
<br />
And judging by http://sqlite.org/changes.html it seems there have been a lot of changes since the 2005 December 19 3.2.8 release included in murgaLua 0.6.9.<br />
<br />
Greetings,<br />
<br />
Jan-Pieter]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[another menu thing]]></title>
			<link>http://www.murga-projects.com/forum/showthread.php?tid=384</link>
			<pubDate>Sat, 01 May 2010 08:47:10 -0600</pubDate>
			<guid isPermaLink="false">http://www.murga-projects.com/forum/showthread.php?tid=384</guid>
			<description><![CDATA[Playing around with homemade menu options again.  This one is kinda visually similar to the collapsable browser I was working on earlier.  It makes use of a pack of buttons that "expand" when clicked.  This example only changes the label text and size a little, but it could be easily modified to load a thumbnail image or other such thing.  It's heavily commented, so that should help in customizing.  I haven't yet added the ability for the buttons to actually DO anything other than change their own appearance =o)<br />
<br />
Screenshot attached.<br />
<br />
EDIT: added a conditional placeholder for a subsequent click on the expanded button.<br />
<br />
<br />
Code:<br />
#!/usr/bin/env murgaLua<br />
<br />
-- Creates a vertical scroll containing an arbitrary number of<br />
-- buttons which grow and change labels when clicked, and collapse<br />
-- when another button is clicked<br />
-- Additional button behavior, such as secondary action by clicking<br />
-- the active button (a logical next step), is not implemented yet<br />
<br />
mbw=64 -- menu button width<br />
mbnh=30 -- button normal height<br />
mbeh=200 -- expanded height<br />
<br />
-- These labels are displayed on buttons in their inactive state.<br />
-- Another table of equal size could be created to store info for<br />
-- active state, or tables of arbitrary size could be generated<br />
-- and used for data in both the build_menu() loop and butt_cb()<br />
menu_labels={"one", "two", "three", "four",<br />
"five", "six", "seven", "eight", "nine", "ten",<br />
"eleven", "twelve", "thirteen", "fourteen",<br />
"fifteen", "sixteen", "seventeen", "eighteen",<br />
"nineteen", "twenty", "twenty-one", "twenty-two"}<br />
<br />
-- Notes on customizing this function:<br />
-- active_butt = previously selected button<br />
-- self = currently selected button <br />
-- (1) This line is auxiliary and disposable<br />
-- (2) Try setting the label to an image or text from a table/file<br />
-- (3) See (1)<br />
function butt_cb(self)<br />
if self:h()==mbeh then -- if self is already expanded<br />
-- put stuff to do on second click here<br />
else<br />
-- expand new button<br />
&nbsp;&nbsp;active_butt:size(mbw,mbnh) -- collapse previous button<br />
&nbsp;&nbsp;active_butt:label(prev_label) -- reset to initial label<br />
&nbsp;&nbsp;active_butt:labelsize(def_sz) -- reset to initial label size (1)<br />
&nbsp;&nbsp;prev_label=self:label() -- backup the initial label of current button<br />
&nbsp;&nbsp;self:label("BIG&#92;n"..prev_label) -- change the label text of current button (2)<br />
&nbsp;&nbsp;self:labelsize(def_sz*2) -- increase label size of current button (3)<br />
&nbsp;&nbsp;self:size(mbw,mbeh) -- expand current button<br />
&nbsp;&nbsp;active_butt=self -- let everyone know which button to collapse next time<br />
&nbsp;&nbsp;menu_scroll:redraw() -- visual clean up<br />
end<br />
end<br />
<br />
function build_menu(x,y,w,h)<br />
menu_button={}<br />
menu_scroll=fltk:Fl_Scroll(x,y,w,h)<br />
menu_scroll:type(2) -- FL_VERTICAL doesn't seem to work<br />
menu_scroll:box(fltk.FL_DOWN_BOX) -- just for looks <br />
menu_pack=fltk:Fl_Pack(x,y,w-20,h-20) -- note 20 pixel space for scrollbar<br />
fltk:Fl_End() -- end pack<br />
fltk:Fl_End() -- end scroll<br />
-- create buttons from menu_labels table<br />
-- This could be made dynamic by, for example,<br />
-- populating the table with a list of files<br />
for i,v in pairs(menu_labels) do<br />
&nbsp;&nbsp;menu_button[i]=fltk:Fl_Button(0,0,mbw,mbnh,v)<br />
&nbsp;&nbsp;menu_button[i]:callback(butt_cb)<br />
&nbsp;&nbsp;menu_pack:add(menu_button[i])<br />
end<br />
end<br />
<br />
w=fltk:Fl_Window(300,600,"menu test 2")<br />
-- x,y,w,h (note: w doesn't need to be mbeh)<br />
build_menu(10,10,mbeh,500)<br />
-- set a default font size (needed only if butt_cb uses it)<br />
def_sz=menu_button[1]:labelsize()<br />
-- set first button active<br />
active_butt=menu_button[1]<br />
-- initialize a prev_label for first use in butt_cb<br />
prev_label=menu_button[1]:label()<br />
--active_butt:do_callback() -- optional<br />
w:show()<br />
Fl:run()<br />
<br />
]]></description>
			<content:encoded><![CDATA[Playing around with homemade menu options again.  This one is kinda visually similar to the collapsable browser I was working on earlier.  It makes use of a pack of buttons that "expand" when clicked.  This example only changes the label text and size a little, but it could be easily modified to load a thumbnail image or other such thing.  It's heavily commented, so that should help in customizing.  I haven't yet added the ability for the buttons to actually DO anything other than change their own appearance =o)<br />
<br />
Screenshot attached.<br />
<br />
EDIT: added a conditional placeholder for a subsequent click on the expanded button.<br />
<br />
<br />
Code:<br />
#!/usr/bin/env murgaLua<br />
<br />
-- Creates a vertical scroll containing an arbitrary number of<br />
-- buttons which grow and change labels when clicked, and collapse<br />
-- when another button is clicked<br />
-- Additional button behavior, such as secondary action by clicking<br />
-- the active button (a logical next step), is not implemented yet<br />
<br />
mbw=64 -- menu button width<br />
mbnh=30 -- button normal height<br />
mbeh=200 -- expanded height<br />
<br />
-- These labels are displayed on buttons in their inactive state.<br />
-- Another table of equal size could be created to store info for<br />
-- active state, or tables of arbitrary size could be generated<br />
-- and used for data in both the build_menu() loop and butt_cb()<br />
menu_labels={"one", "two", "three", "four",<br />
"five", "six", "seven", "eight", "nine", "ten",<br />
"eleven", "twelve", "thirteen", "fourteen",<br />
"fifteen", "sixteen", "seventeen", "eighteen",<br />
"nineteen", "twenty", "twenty-one", "twenty-two"}<br />
<br />
-- Notes on customizing this function:<br />
-- active_butt = previously selected button<br />
-- self = currently selected button <br />
-- (1) This line is auxiliary and disposable<br />
-- (2) Try setting the label to an image or text from a table/file<br />
-- (3) See (1)<br />
function butt_cb(self)<br />
if self:h()==mbeh then -- if self is already expanded<br />
-- put stuff to do on second click here<br />
else<br />
-- expand new button<br />
&nbsp;&nbsp;active_butt:size(mbw,mbnh) -- collapse previous button<br />
&nbsp;&nbsp;active_butt:label(prev_label) -- reset to initial label<br />
&nbsp;&nbsp;active_butt:labelsize(def_sz) -- reset to initial label size (1)<br />
&nbsp;&nbsp;prev_label=self:label() -- backup the initial label of current button<br />
&nbsp;&nbsp;self:label("BIG&#92;n"..prev_label) -- change the label text of current button (2)<br />
&nbsp;&nbsp;self:labelsize(def_sz*2) -- increase label size of current button (3)<br />
&nbsp;&nbsp;self:size(mbw,mbeh) -- expand current button<br />
&nbsp;&nbsp;active_butt=self -- let everyone know which button to collapse next time<br />
&nbsp;&nbsp;menu_scroll:redraw() -- visual clean up<br />
end<br />
end<br />
<br />
function build_menu(x,y,w,h)<br />
menu_button={}<br />
menu_scroll=fltk:Fl_Scroll(x,y,w,h)<br />
menu_scroll:type(2) -- FL_VERTICAL doesn't seem to work<br />
menu_scroll:box(fltk.FL_DOWN_BOX) -- just for looks <br />
menu_pack=fltk:Fl_Pack(x,y,w-20,h-20) -- note 20 pixel space for scrollbar<br />
fltk:Fl_End() -- end pack<br />
fltk:Fl_End() -- end scroll<br />
-- create buttons from menu_labels table<br />
-- This could be made dynamic by, for example,<br />
-- populating the table with a list of files<br />
for i,v in pairs(menu_labels) do<br />
&nbsp;&nbsp;menu_button[i]=fltk:Fl_Button(0,0,mbw,mbnh,v)<br />
&nbsp;&nbsp;menu_button[i]:callback(butt_cb)<br />
&nbsp;&nbsp;menu_pack:add(menu_button[i])<br />
end<br />
end<br />
<br />
w=fltk:Fl_Window(300,600,"menu test 2")<br />
-- x,y,w,h (note: w doesn't need to be mbeh)<br />
build_menu(10,10,mbeh,500)<br />
-- set a default font size (needed only if butt_cb uses it)<br />
def_sz=menu_button[1]:labelsize()<br />
-- set first button active<br />
active_butt=menu_button[1]<br />
-- initialize a prev_label for first use in butt_cb<br />
prev_label=menu_button[1]:label()<br />
--active_butt:do_callback() -- optional<br />
w:show()<br />
Fl:run()<br />
<br />
]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Weaknesses in exportXml]]></title>
			<link>http://www.murga-projects.com/forum/showthread.php?tid=383</link>
			<pubDate>Thu, 29 Apr 2010 16:54:39 -0600</pubDate>
			<guid isPermaLink="false">http://www.murga-projects.com/forum/showthread.php?tid=383</guid>
			<description><![CDATA[Hi!<br />
<br />
Found out some weaknesses in exportXml<br />
* it does not support io.stdout or io.stderr. Besides it would be nice to be able to export to a xml-string to, for example to insert XSL/DTD/... stuff, and not having to read it out of the file again<br />
<br />
* It doesn't take care of keys with spaces in the tables, the first word will appear as the tag, the following ones as attributes. As a side effect this borkes the reading in by loadFromXml() as it gets ... as tags.<br />
As a temporary workaround, replaces spaces in keys with __ :<br />
<br />
function prepTable (tab,unprep)<br />
    local newTab={}<br />
    local pat = unprep and '__' or '%s+'<br />
    local rep = unprep and ' '  or '__'<br />
    for k,v in pairs(tab) do<br />
        newTab[(k:gsub(pat,rep))]= type(v)=="table" and prepTable(v,unprep) or v<br />
    end<br />
    return newTab<br />
end<br />
<br />
Greetz,<br />
<br />
Jan-Pieter]]></description>
			<content:encoded><![CDATA[Hi!<br />
<br />
Found out some weaknesses in exportXml<br />
* it does not support io.stdout or io.stderr. Besides it would be nice to be able to export to a xml-string to, for example to insert XSL/DTD/... stuff, and not having to read it out of the file again<br />
<br />
* It doesn't take care of keys with spaces in the tables, the first word will appear as the tag, the following ones as attributes. As a side effect this borkes the reading in by loadFromXml() as it gets ... as tags.<br />
As a temporary workaround, replaces spaces in keys with __ :<br />
<br />
function prepTable (tab,unprep)<br />
    local newTab={}<br />
    local pat = unprep and '__' or '%s+'<br />
    local rep = unprep and ' '  or '__'<br />
    for k,v in pairs(tab) do<br />
        newTab[(k:gsub(pat,rep))]= type(v)=="table" and prepTable(v,unprep) or v<br />
    end<br />
    return newTab<br />
end<br />
<br />
Greetz,<br />
<br />
Jan-Pieter]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[PONG]]></title>
			<link>http://www.murga-projects.com/forum/showthread.php?tid=382</link>
			<pubDate>Wed, 21 Apr 2010 05:37:18 -0600</pubDate>
			<guid isPermaLink="false">http://www.murga-projects.com/forum/showthread.php?tid=382</guid>
			<description><![CDATA[Here's version one of a one player Pong. <br />
Move the mouse up and down to control both paddels.<br />
The ball speed increases up to a point each time its hit by a paddle or a the left and right sides.<br />
<br />
I've attached the Fluid file.<br />
<br />
<br />
Code:<br />
math.randomseed(os.time())<br />
bvx=math.random(1,2)<br />
bvy=math.random(1,2)-1<br />
leftscore=0<br />
rightscore=0<br />
ballspeed=2<br />
maxballspeed=9<br />
ballspeedinc=0.2<br />
playGame=true<br />
oldTime=os.time()<br />
--total distance per second<br />
tdx,tdy= 0,0<br />
--inrect<br />
function inrect(x,y,xx,yy,xxx,yyy)<br />
if x&gt;=xx and x&lt;=xxx and y&gt;=yy and y&lt;=yyy then return true end<br />
return false<br />
end<br />
--ballspeedup<br />
function ballspeedup()<br />
if ballspeed &lt; maxballspeed then ballspeed=ballspeed+ballspeedinc end<br />
end<br />
--borderball detects border hit<br />
function borderball()<br />
bx,by=Ball:x(),Ball:y()<br />
bxx,byy=bx+16,by+16<br />
borderhit=false<br />
<br />
<br />
-- if the ball exits&nbsp;&nbsp;the gamefield then reset to center<br />
if inrect(bx,by,fx,fy,fxx,fyy) ~= true and inrect(bxx,byy,fx,fy,fxx,fyy) ~= true then<br />
bx,by = (FIELDBOX:w()/2)+1,(FIELDBOX:h()/2)+1<br />
Ball:resize(bx,by,16,16)<br />
end<br />
<br />
--if the ball is beyond the left side of the field, reverse x direction<br />
&nbsp;&nbsp;&nbsp;&nbsp;if bx &lt;=fx then<br />
 &nbsp;&nbsp;&nbsp;&nbsp;bvx=1<br />
 &nbsp;&nbsp;&nbsp;&nbsp;borderhit=true<br />
 &nbsp;&nbsp;&nbsp;&nbsp;rightscore=rightscore+1<br />
 &nbsp;&nbsp;&nbsp;&nbsp;SCORERIGHT:value(rightscore) <br />
 &nbsp;&nbsp;&nbsp;&nbsp;ballspeedup()<br />
 &nbsp;&nbsp;&nbsp;&nbsp;end<br />
--if the ball is beyond the right side of the field, reverse x direction<br />
 &nbsp;&nbsp;&nbsp;&nbsp;if bxx &gt;= fxx then<br />
 &nbsp;&nbsp;&nbsp;&nbsp;bvx=-1<br />
 &nbsp;&nbsp;&nbsp;&nbsp;<br />
 &nbsp;&nbsp;&nbsp;&nbsp;leftscore=leftscore+1<br />
 &nbsp;&nbsp;&nbsp;&nbsp;SCORELEFT:value(leftscore)<br />
 &nbsp;&nbsp;&nbsp;&nbsp;ballspeedup()<br />
 &nbsp;&nbsp;&nbsp;&nbsp;end<br />
 &nbsp;&nbsp;&nbsp;&nbsp;<br />
--if the ball hits the top of the field then reverse direction<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if by &lt;=fy then<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;bvy=1<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ballspeedup()<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Ball:labelcolor(95)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
--if the ball hits the bottom of the field&nbsp;&nbsp;reverse direction&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;&nbsp;byy &gt;= fyy then <br />
&nbsp;&nbsp;&nbsp;&nbsp;bvy=-1 <br />
&nbsp;&nbsp;&nbsp;&nbsp;ballspeedup()<br />
&nbsp;&nbsp;&nbsp;&nbsp;Ball:labelcolor(95)<br />
&nbsp;&nbsp;&nbsp;&nbsp;end<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;if borderhit == true then<br />
&nbsp;&nbsp;&nbsp;&nbsp;bvy=math.random(1,2)<br />
&nbsp;&nbsp;&nbsp;&nbsp;if bvy==2 then <br />
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;bvy=1<br />
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else<br />
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;bvy=-1<br />
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
 &nbsp;&nbsp;&nbsp;&nbsp;end<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
return bvx,bvy<br />
end<br />
--blockball<br />
function blockball(px,py,pxx,pyy)<br />
bx,by=Ball:x()+bvx,Ball:y()+bvy<br />
bxx,byy=bx+16,by+16<br />
<br />
--if the ball is still in the field then detect block hits<br />
if inrect(bx,by,px,py,pxx,pyy) == true or inrect(bxx,byy,px,py,pxx,pyy) == true then<br />
<br />
--if the ball is on the left side of the field<br />
&nbsp;&nbsp;&nbsp;&nbsp;if bx &lt;= (FIELDBOX:w()/2) then<br />
 &nbsp;&nbsp;&nbsp;&nbsp;bvx=1<br />
 &nbsp;&nbsp;&nbsp;&nbsp;Ball:labelcolor(80)<br />
 &nbsp;&nbsp;&nbsp;&nbsp;--or if its on the right side<br />
 &nbsp;&nbsp;&nbsp;&nbsp;else<br />
 &nbsp;&nbsp;&nbsp;&nbsp;bvx=-1<br />
 &nbsp;&nbsp;&nbsp;&nbsp;Ball:labelcolor(220)<br />
 &nbsp;&nbsp;&nbsp;&nbsp;end<br />
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
 &nbsp;&nbsp;&nbsp;&nbsp;<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
byr=math.random(1,15) <br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if byr &lt;= 5 then bvy=0 end<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if byr&nbsp;&nbsp;&gt;= 6 and byr &lt;= 10 then bvy=-1 end<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if byr &gt;= 11 then bvy=1 end&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
 end<br />
<br />
end<br />
-- moveBall<br />
function moveBall()<br />
-- move the ball<br />
<br />
bx,by = Ball:x(),Ball:y()<br />
obx,oby = bx,by<br />
bx=bx+bvx*ballspeed<br />
by=by+bvy*ballspeed<br />
Ball:resize(bx,by,16,16)<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;--total distance <br />
&nbsp;&nbsp;&nbsp;&nbsp;tdx=tdx+(math.abs(bvx)*ballspeed)<br />
&nbsp;&nbsp;&nbsp;&nbsp;tdy=tdy+(math.abs(bvy)*ballspeed)<br />
&nbsp;&nbsp;&nbsp;&nbsp;if os.time()-oldTime &gt;= 1 then<br />
&nbsp;&nbsp;&nbsp;&nbsp;distance:label("distance per second x:"..tdx.."&nbsp;&nbsp;y:"..tdy)<br />
&nbsp;&nbsp;&nbsp;&nbsp;tdx,tdy= 0,0<br />
&nbsp;&nbsp;&nbsp;&nbsp;oldTime=os.time()<br />
&nbsp;&nbsp;&nbsp;&nbsp;end<br />
end<br />
-- movePaddles <br />
function movePaddles()<br />
mx=Fl:event_x()<br />
my=Fl:event_y()<br />
<br />
lx,ly=LEFTBOX:x(),LEFTBOX:y()<br />
lxx,lyy=lx+LEFTBOX:w(),my+LEFTBOX:h()<br />
if inrect(mx,my,fx,fy,fxx,fyy) == true and inrect(mx,lyy,fx,fy,fxx,fyy) == true then<br />
LEFTBOX:resize(lx,my,LEFTBOX:w(),LEFTBOX:h())<br />
end<br />
<br />
rx,ry=RIGHTBOX:x(),RIGHTBOX:y()<br />
rxx,ryy=rx+RIGHTBOX:w(),my+RIGHTBOX:h()<br />
<br />
if inrect(mx,my,fx,fy,fxx,fyy) == true and inrect(mx,ryy,fx,fy,fxx,fyy) == true then<br />
RIGHTBOX:resize(rx,my,RIGHTBOX:w(),RIGHTBOX:h())<br />
end<br />
<br />
<br />
lx,ly=LEFTBOX:x(),LEFTBOX:y()<br />
lxx,lyy=lx+LEFTBOX:w(),my+LEFTBOX:h()<br />
rx,ry=RIGHTBOX:x(),RIGHTBOX:y()<br />
rxx,ryy=rx+RIGHTBOX:w(),ry+RIGHTBOX:h()<br />
blockball(lx,ly,lxx,lyy)<br />
blockball(rx,ry,rxx,ryy)<br />
<br />
end<br />
--playPong<br />
function playPong()<br />
<br />
 if (Fl:event_text()== "q") then os.exit() end<br />
 <br />
 speedkey=tonumber(Fl:event_text())<br />
 if speedkey ~= nil then<br />
 if speedkey &gt;= 1 and speedkey &lt;=9 then ballspeed=speedkey end<br />
&nbsp;&nbsp;&nbsp;&nbsp;end &nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;if playGame == true then<br />
&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp; movePaddles()<br />
&nbsp;&nbsp;&nbsp;&nbsp; borderball()<br />
&nbsp;&nbsp;&nbsp;&nbsp; moveBall()<br />
&nbsp;&nbsp;&nbsp;&nbsp; <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Pong:redraw()<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -- murgaLua.sleepMilliseconds(10)<br />
&nbsp;&nbsp;&nbsp;&nbsp;end<br />
end<br />
--pongWindow_CB<br />
function pongWindow_CB()<br />
<br />
if (Fl:event_key()== fltk.FL_Escape) then playGame=not playGame end<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;if playGame == true then<br />
&nbsp;&nbsp;&nbsp;&nbsp;Pong:label("PONG")<br />
&nbsp;&nbsp;&nbsp;&nbsp;else<br />
&nbsp;&nbsp;&nbsp;&nbsp;Pong:label("PONG&nbsp;&nbsp;(PAUSED)")<br />
&nbsp;&nbsp;&nbsp;&nbsp;end<br />
end<br />
<br />
do Pong= fltk:Fl_Double_Window(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, "PONG")<br />
Pong:label(gLabelTable[#gLabelTable])<br />
Pong:callback(pongWindow_CB)<br />
Pong:resize(380,194,652,443)<br />
Pong:color(0)<br />
<br />
do FIELDBOX= fltk:Fl_Box(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, "FIELDBOX")<br />
FIELDBOX:label(gLabelTable[#gLabelTable])<br />
FIELDBOX:resize(0,0,655,444)<br />
FIELDBOX:box(fltk.FL_FLAT_BOX)<br />
FIELDBOX:color(0)<br />
FIELDBOX:labeltype(fltk.FL_NO_LABEL)<br />
FIELDBOX:labelcolor(33)<br />
end<br />
<br />
do SCORELEFT= fltk:Fl_Output(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, "SCORELEFT")<br />
SCORELEFT:label(gLabelTable[#gLabelTable])<br />
SCORELEFT:resize(205,1,60,51)<br />
SCORELEFT:box(fltk.FL_NO_BOX)<br />
SCORELEFT:color(0)<br />
SCORELEFT:labeltype(fltk.FL_NO_LABEL)<br />
SCORELEFT:labelsize(7)<br />
SCORELEFT:labelcolor(72)<br />
SCORELEFT:textsize(36)<br />
SCORELEFT:textcolor(72)<br />
end<br />
<br />
do SCORERIGHT= fltk:Fl_Output(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, "SCORERIGHT")<br />
SCORERIGHT:label(gLabelTable[#gLabelTable])<br />
SCORERIGHT:resize(385,0,65,51)<br />
SCORERIGHT:box(fltk.FL_NO_BOX)<br />
SCORERIGHT:color(0)<br />
SCORERIGHT:selection_color(177)<br />
SCORERIGHT:labeltype(fltk.FL_NO_LABEL)<br />
SCORERIGHT:labelsize(7)<br />
SCORERIGHT:labelcolor(72)<br />
SCORERIGHT:textsize(36)<br />
SCORERIGHT:textcolor(177)<br />
end<br />
<br />
do LEFTBOX= fltk:Fl_Box(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, "LeftBox")<br />
LEFTBOX:label(gLabelTable[#gLabelTable])<br />
LEFTBOX:resize(25,193,24,82)<br />
LEFTBOX:box(fltk.FL_FLAT_BOX)<br />
LEFTBOX:color(80)<br />
LEFTBOX:labeltype(fltk.FL_NO_LABEL)<br />
LEFTBOX:labelsize(7)<br />
LEFTBOX:labelcolor(88)<br />
end<br />
<br />
do RIGHTBOX= fltk:Fl_Box(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, "Rightbox")<br />
RIGHTBOX:label(gLabelTable[#gLabelTable])<br />
RIGHTBOX:resize(600,193,24,82)<br />
RIGHTBOX:box(fltk.FL_FLAT_BOX)<br />
RIGHTBOX:color(220)<br />
RIGHTBOX:labeltype(fltk.FL_NO_LABEL)<br />
RIGHTBOX:labelsize(7)<br />
RIGHTBOX:labelcolor(216)<br />
end<br />
<br />
do instructions= fltk:Fl_Box(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, "ESC to Pause&nbsp;&nbsp; Q to QUIT")<br />
instructions:label(gLabelTable[#gLabelTable])<br />
instructions:resize(0,-1,650,16)<br />
instructions:labelsize(10)<br />
instructions:labelcolor(63)<br />
end<br />
<br />
do distance= fltk:Fl_Box(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, "distance per second")<br />
distance:label(gLabelTable[#gLabelTable])<br />
distance:resize(0,427,650,16)<br />
distance:labelsize(10)<br />
distance:labelcolor(63)<br />
end<br />
<br />
do Ball= fltk:Fl_Box(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, "¥")<br />
Ball:label(gLabelTable[#gLabelTable])<br />
Ball:resize(320,226,15,16)<br />
Ball:labelsize(16)<br />
Ball:labelcolor(95)<br />
end<br />
end<br />
Pong:show()<br />
<br />
gLabelTable[#gLabelTable] ="@circle"<br />
Ball:label(gLabelTable[#gLabelTable])<br />
<br />
Pong:make_current();<br />
fx,fy=FIELDBOX:x()+8,FIELDBOX:y()+8<br />
fxx,fyy=fx+FIELDBOX:w()-8,fy+FIELDBOX:h()-8<br />
<br />
while Pong do<br />
 Fl:check()<br />
playPong()&nbsp;&nbsp;&nbsp;&nbsp; <br />
end<br />
Fl:run()<br />
<br />
]]></description>
			<content:encoded><![CDATA[Here's version one of a one player Pong. <br />
Move the mouse up and down to control both paddels.<br />
The ball speed increases up to a point each time its hit by a paddle or a the left and right sides.<br />
<br />
I've attached the Fluid file.<br />
<br />
<br />
Code:<br />
math.randomseed(os.time())<br />
bvx=math.random(1,2)<br />
bvy=math.random(1,2)-1<br />
leftscore=0<br />
rightscore=0<br />
ballspeed=2<br />
maxballspeed=9<br />
ballspeedinc=0.2<br />
playGame=true<br />
oldTime=os.time()<br />
--total distance per second<br />
tdx,tdy= 0,0<br />
--inrect<br />
function inrect(x,y,xx,yy,xxx,yyy)<br />
if x&gt;=xx and x&lt;=xxx and y&gt;=yy and y&lt;=yyy then return true end<br />
return false<br />
end<br />
--ballspeedup<br />
function ballspeedup()<br />
if ballspeed &lt; maxballspeed then ballspeed=ballspeed+ballspeedinc end<br />
end<br />
--borderball detects border hit<br />
function borderball()<br />
bx,by=Ball:x(),Ball:y()<br />
bxx,byy=bx+16,by+16<br />
borderhit=false<br />
<br />
<br />
-- if the ball exits&nbsp;&nbsp;the gamefield then reset to center<br />
if inrect(bx,by,fx,fy,fxx,fyy) ~= true and inrect(bxx,byy,fx,fy,fxx,fyy) ~= true then<br />
bx,by = (FIELDBOX:w()/2)+1,(FIELDBOX:h()/2)+1<br />
Ball:resize(bx,by,16,16)<br />
end<br />
<br />
--if the ball is beyond the left side of the field, reverse x direction<br />
&nbsp;&nbsp;&nbsp;&nbsp;if bx &lt;=fx then<br />
 &nbsp;&nbsp;&nbsp;&nbsp;bvx=1<br />
 &nbsp;&nbsp;&nbsp;&nbsp;borderhit=true<br />
 &nbsp;&nbsp;&nbsp;&nbsp;rightscore=rightscore+1<br />
 &nbsp;&nbsp;&nbsp;&nbsp;SCORERIGHT:value(rightscore) <br />
 &nbsp;&nbsp;&nbsp;&nbsp;ballspeedup()<br />
 &nbsp;&nbsp;&nbsp;&nbsp;end<br />
--if the ball is beyond the right side of the field, reverse x direction<br />
 &nbsp;&nbsp;&nbsp;&nbsp;if bxx &gt;= fxx then<br />
 &nbsp;&nbsp;&nbsp;&nbsp;bvx=-1<br />
 &nbsp;&nbsp;&nbsp;&nbsp;<br />
 &nbsp;&nbsp;&nbsp;&nbsp;leftscore=leftscore+1<br />
 &nbsp;&nbsp;&nbsp;&nbsp;SCORELEFT:value(leftscore)<br />
 &nbsp;&nbsp;&nbsp;&nbsp;ballspeedup()<br />
 &nbsp;&nbsp;&nbsp;&nbsp;end<br />
 &nbsp;&nbsp;&nbsp;&nbsp;<br />
--if the ball hits the top of the field then reverse direction<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if by &lt;=fy then<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;bvy=1<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ballspeedup()<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Ball:labelcolor(95)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
--if the ball hits the bottom of the field&nbsp;&nbsp;reverse direction&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;&nbsp;byy &gt;= fyy then <br />
&nbsp;&nbsp;&nbsp;&nbsp;bvy=-1 <br />
&nbsp;&nbsp;&nbsp;&nbsp;ballspeedup()<br />
&nbsp;&nbsp;&nbsp;&nbsp;Ball:labelcolor(95)<br />
&nbsp;&nbsp;&nbsp;&nbsp;end<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;if borderhit == true then<br />
&nbsp;&nbsp;&nbsp;&nbsp;bvy=math.random(1,2)<br />
&nbsp;&nbsp;&nbsp;&nbsp;if bvy==2 then <br />
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;bvy=1<br />
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else<br />
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;bvy=-1<br />
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
 &nbsp;&nbsp;&nbsp;&nbsp;end<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
return bvx,bvy<br />
end<br />
--blockball<br />
function blockball(px,py,pxx,pyy)<br />
bx,by=Ball:x()+bvx,Ball:y()+bvy<br />
bxx,byy=bx+16,by+16<br />
<br />
--if the ball is still in the field then detect block hits<br />
if inrect(bx,by,px,py,pxx,pyy) == true or inrect(bxx,byy,px,py,pxx,pyy) == true then<br />
<br />
--if the ball is on the left side of the field<br />
&nbsp;&nbsp;&nbsp;&nbsp;if bx &lt;= (FIELDBOX:w()/2) then<br />
 &nbsp;&nbsp;&nbsp;&nbsp;bvx=1<br />
 &nbsp;&nbsp;&nbsp;&nbsp;Ball:labelcolor(80)<br />
 &nbsp;&nbsp;&nbsp;&nbsp;--or if its on the right side<br />
 &nbsp;&nbsp;&nbsp;&nbsp;else<br />
 &nbsp;&nbsp;&nbsp;&nbsp;bvx=-1<br />
 &nbsp;&nbsp;&nbsp;&nbsp;Ball:labelcolor(220)<br />
 &nbsp;&nbsp;&nbsp;&nbsp;end<br />
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
 &nbsp;&nbsp;&nbsp;&nbsp;<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
byr=math.random(1,15) <br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if byr &lt;= 5 then bvy=0 end<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if byr&nbsp;&nbsp;&gt;= 6 and byr &lt;= 10 then bvy=-1 end<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if byr &gt;= 11 then bvy=1 end&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
 end<br />
<br />
end<br />
-- moveBall<br />
function moveBall()<br />
-- move the ball<br />
<br />
bx,by = Ball:x(),Ball:y()<br />
obx,oby = bx,by<br />
bx=bx+bvx*ballspeed<br />
by=by+bvy*ballspeed<br />
Ball:resize(bx,by,16,16)<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;--total distance <br />
&nbsp;&nbsp;&nbsp;&nbsp;tdx=tdx+(math.abs(bvx)*ballspeed)<br />
&nbsp;&nbsp;&nbsp;&nbsp;tdy=tdy+(math.abs(bvy)*ballspeed)<br />
&nbsp;&nbsp;&nbsp;&nbsp;if os.time()-oldTime &gt;= 1 then<br />
&nbsp;&nbsp;&nbsp;&nbsp;distance:label("distance per second x:"..tdx.."&nbsp;&nbsp;y:"..tdy)<br />
&nbsp;&nbsp;&nbsp;&nbsp;tdx,tdy= 0,0<br />
&nbsp;&nbsp;&nbsp;&nbsp;oldTime=os.time()<br />
&nbsp;&nbsp;&nbsp;&nbsp;end<br />
end<br />
-- movePaddles <br />
function movePaddles()<br />
mx=Fl:event_x()<br />
my=Fl:event_y()<br />
<br />
lx,ly=LEFTBOX:x(),LEFTBOX:y()<br />
lxx,lyy=lx+LEFTBOX:w(),my+LEFTBOX:h()<br />
if inrect(mx,my,fx,fy,fxx,fyy) == true and inrect(mx,lyy,fx,fy,fxx,fyy) == true then<br />
LEFTBOX:resize(lx,my,LEFTBOX:w(),LEFTBOX:h())<br />
end<br />
<br />
rx,ry=RIGHTBOX:x(),RIGHTBOX:y()<br />
rxx,ryy=rx+RIGHTBOX:w(),my+RIGHTBOX:h()<br />
<br />
if inrect(mx,my,fx,fy,fxx,fyy) == true and inrect(mx,ryy,fx,fy,fxx,fyy) == true then<br />
RIGHTBOX:resize(rx,my,RIGHTBOX:w(),RIGHTBOX:h())<br />
end<br />
<br />
<br />
lx,ly=LEFTBOX:x(),LEFTBOX:y()<br />
lxx,lyy=lx+LEFTBOX:w(),my+LEFTBOX:h()<br />
rx,ry=RIGHTBOX:x(),RIGHTBOX:y()<br />
rxx,ryy=rx+RIGHTBOX:w(),ry+RIGHTBOX:h()<br />
blockball(lx,ly,lxx,lyy)<br />
blockball(rx,ry,rxx,ryy)<br />
<br />
end<br />
--playPong<br />
function playPong()<br />
<br />
 if (Fl:event_text()== "q") then os.exit() end<br />
 <br />
 speedkey=tonumber(Fl:event_text())<br />
 if speedkey ~= nil then<br />
 if speedkey &gt;= 1 and speedkey &lt;=9 then ballspeed=speedkey end<br />
&nbsp;&nbsp;&nbsp;&nbsp;end &nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;if playGame == true then<br />
&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp; movePaddles()<br />
&nbsp;&nbsp;&nbsp;&nbsp; borderball()<br />
&nbsp;&nbsp;&nbsp;&nbsp; moveBall()<br />
&nbsp;&nbsp;&nbsp;&nbsp; <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Pong:redraw()<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -- murgaLua.sleepMilliseconds(10)<br />
&nbsp;&nbsp;&nbsp;&nbsp;end<br />
end<br />
--pongWindow_CB<br />
function pongWindow_CB()<br />
<br />
if (Fl:event_key()== fltk.FL_Escape) then playGame=not playGame end<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;if playGame == true then<br />
&nbsp;&nbsp;&nbsp;&nbsp;Pong:label("PONG")<br />
&nbsp;&nbsp;&nbsp;&nbsp;else<br />
&nbsp;&nbsp;&nbsp;&nbsp;Pong:label("PONG&nbsp;&nbsp;(PAUSED)")<br />
&nbsp;&nbsp;&nbsp;&nbsp;end<br />
end<br />
<br />
do Pong= fltk:Fl_Double_Window(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, "PONG")<br />
Pong:label(gLabelTable[#gLabelTable])<br />
Pong:callback(pongWindow_CB)<br />
Pong:resize(380,194,652,443)<br />
Pong:color(0)<br />
<br />
do FIELDBOX= fltk:Fl_Box(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, "FIELDBOX")<br />
FIELDBOX:label(gLabelTable[#gLabelTable])<br />
FIELDBOX:resize(0,0,655,444)<br />
FIELDBOX:box(fltk.FL_FLAT_BOX)<br />
FIELDBOX:color(0)<br />
FIELDBOX:labeltype(fltk.FL_NO_LABEL)<br />
FIELDBOX:labelcolor(33)<br />
end<br />
<br />
do SCORELEFT= fltk:Fl_Output(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, "SCORELEFT")<br />
SCORELEFT:label(gLabelTable[#gLabelTable])<br />
SCORELEFT:resize(205,1,60,51)<br />
SCORELEFT:box(fltk.FL_NO_BOX)<br />
SCORELEFT:color(0)<br />
SCORELEFT:labeltype(fltk.FL_NO_LABEL)<br />
SCORELEFT:labelsize(7)<br />
SCORELEFT:labelcolor(72)<br />
SCORELEFT:textsize(36)<br />
SCORELEFT:textcolor(72)<br />
end<br />
<br />
do SCORERIGHT= fltk:Fl_Output(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, "SCORERIGHT")<br />
SCORERIGHT:label(gLabelTable[#gLabelTable])<br />
SCORERIGHT:resize(385,0,65,51)<br />
SCORERIGHT:box(fltk.FL_NO_BOX)<br />
SCORERIGHT:color(0)<br />
SCORERIGHT:selection_color(177)<br />
SCORERIGHT:labeltype(fltk.FL_NO_LABEL)<br />
SCORERIGHT:labelsize(7)<br />
SCORERIGHT:labelcolor(72)<br />
SCORERIGHT:textsize(36)<br />
SCORERIGHT:textcolor(177)<br />
end<br />
<br />
do LEFTBOX= fltk:Fl_Box(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, "LeftBox")<br />
LEFTBOX:label(gLabelTable[#gLabelTable])<br />
LEFTBOX:resize(25,193,24,82)<br />
LEFTBOX:box(fltk.FL_FLAT_BOX)<br />
LEFTBOX:color(80)<br />
LEFTBOX:labeltype(fltk.FL_NO_LABEL)<br />
LEFTBOX:labelsize(7)<br />
LEFTBOX:labelcolor(88)<br />
end<br />
<br />
do RIGHTBOX= fltk:Fl_Box(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, "Rightbox")<br />
RIGHTBOX:label(gLabelTable[#gLabelTable])<br />
RIGHTBOX:resize(600,193,24,82)<br />
RIGHTBOX:box(fltk.FL_FLAT_BOX)<br />
RIGHTBOX:color(220)<br />
RIGHTBOX:labeltype(fltk.FL_NO_LABEL)<br />
RIGHTBOX:labelsize(7)<br />
RIGHTBOX:labelcolor(216)<br />
end<br />
<br />
do instructions= fltk:Fl_Box(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, "ESC to Pause&nbsp;&nbsp; Q to QUIT")<br />
instructions:label(gLabelTable[#gLabelTable])<br />
instructions:resize(0,-1,650,16)<br />
instructions:labelsize(10)<br />
instructions:labelcolor(63)<br />
end<br />
<br />
do distance= fltk:Fl_Box(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, "distance per second")<br />
distance:label(gLabelTable[#gLabelTable])<br />
distance:resize(0,427,650,16)<br />
distance:labelsize(10)<br />
distance:labelcolor(63)<br />
end<br />
<br />
do Ball= fltk:Fl_Box(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, "¥")<br />
Ball:label(gLabelTable[#gLabelTable])<br />
Ball:resize(320,226,15,16)<br />
Ball:labelsize(16)<br />
Ball:labelcolor(95)<br />
end<br />
end<br />
Pong:show()<br />
<br />
gLabelTable[#gLabelTable] ="@circle"<br />
Ball:label(gLabelTable[#gLabelTable])<br />
<br />
Pong:make_current();<br />
fx,fy=FIELDBOX:x()+8,FIELDBOX:y()+8<br />
fxx,fyy=fx+FIELDBOX:w()-8,fy+FIELDBOX:h()-8<br />
<br />
while Pong do<br />
 Fl:check()<br />
playPong()&nbsp;&nbsp;&nbsp;&nbsp; <br />
end<br />
Fl:run()<br />
<br />
]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Magic 8 Box]]></title>
			<link>http://www.murga-projects.com/forum/showthread.php?tid=381</link>
			<pubDate>Sun, 18 Apr 2010 18:34:40 -0600</pubDate>
			<guid isPermaLink="false">http://www.murga-projects.com/forum/showthread.php?tid=381</guid>
			<description><![CDATA[Ask a question, shake the box, and let the all knowing MurgaLua Magic 8 Box solve all of life's problems.<br />
<br />
Code:<br />
EightBallAnswers={"Outlook Good", "Outlook Not So Good ", "My Reply Is No", "Don't Count On It", "You May Rely On It", "Ask Again Later", "Most Likely ", "Cannot Predict Now", "Yes ", "Yes, definitely", "Better Not Tell You Now ", "It Is Certain", "Very Doubtful", "It Is Decidedly So", "Concentrate And Ask Again", "Signs Point To Yes ", "My Sources Say No ", "Without A Doubt ", "Reply Hazy, Try Again", "As I See It, Yes"}<br />
math.randomseed(os.time())<br />
function shakebox()<br />
local shakeammount=math.random(8,16)<br />
local answer=math.random(1,#EightBallAnswers)<br />
local wx=EightBox:x()<br />
local wy=EightBox:y()<br />
local ww=EightBox:h()<br />
local wh=EightBox:w()<br />
<br />
for i = 1,shakeammount,1 do<br />
EightBox:resize(wx-8,wy,wh,ww)<br />
Fl:wait(0)<br />
EightBox:resize(wx,wy-8,wh,ww)<br />
Fl:wait(0)<br />
EightBox:resize(wx+8,wy,wh,ww)<br />
Fl:wait(0)<br />
EightBox:resize(wx,wy+8,wh,ww)<br />
end<br />
Fl:wait(0)<br />
EightBox:resize(wx,wy,wh,ww)<br />
EightBox:redraw()<br />
AnswerOutput:value(EightBallAnswers[answer])<br />
end<br />
do EightBox= fltk:Fl_Double_Window(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, "MAGIC 8 BOX")<br />
EightBox:label(gLabelTable[#gLabelTable])<br />
EightBox:resize(509,283,362,119)<br />
<br />
do background= fltk:Fl_Box(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, "label")<br />
background:label(gLabelTable[#gLabelTable])<br />
background:resize(0,-1,365,237)<br />
background:box(fltk.FL_FLAT_BOX)<br />
background:color(0)<br />
end<br />
<br />
do ShakeButton= fltk:Fl_Button(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, "Shake")<br />
ShakeButton:label(gLabelTable[#gLabelTable])<br />
ShakeButton:callback(shakebox)<br />
ShakeButton:resize(0,75,365,45)<br />
ShakeButton:box(fltk.FL_NO_BOX)<br />
ShakeButton:labelfont(1)<br />
ShakeButton:labelsize(21)<br />
ShakeButton:labelcolor(1)<br />
end<br />
<br />
do AnswerOutput= fltk:Fl_Output(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, " ")<br />
AnswerOutput:label(gLabelTable[#gLabelTable])<br />
AnswerOutput:resize(20,16,325,39)<br />
AnswerOutput:box(fltk.FL_NO_BOX)<br />
AnswerOutput:textcolor(2)<br />
end<br />
end<br />
EightBox:show()<br />
Fl:run()<br />
<br />
]]></description>
			<content:encoded><![CDATA[Ask a question, shake the box, and let the all knowing MurgaLua Magic 8 Box solve all of life's problems.<br />
<br />
Code:<br />
EightBallAnswers={"Outlook Good", "Outlook Not So Good ", "My Reply Is No", "Don't Count On It", "You May Rely On It", "Ask Again Later", "Most Likely ", "Cannot Predict Now", "Yes ", "Yes, definitely", "Better Not Tell You Now ", "It Is Certain", "Very Doubtful", "It Is Decidedly So", "Concentrate And Ask Again", "Signs Point To Yes ", "My Sources Say No ", "Without A Doubt ", "Reply Hazy, Try Again", "As I See It, Yes"}<br />
math.randomseed(os.time())<br />
function shakebox()<br />
local shakeammount=math.random(8,16)<br />
local answer=math.random(1,#EightBallAnswers)<br />
local wx=EightBox:x()<br />
local wy=EightBox:y()<br />
local ww=EightBox:h()<br />
local wh=EightBox:w()<br />
<br />
for i = 1,shakeammount,1 do<br />
EightBox:resize(wx-8,wy,wh,ww)<br />
Fl:wait(0)<br />
EightBox:resize(wx,wy-8,wh,ww)<br />
Fl:wait(0)<br />
EightBox:resize(wx+8,wy,wh,ww)<br />
Fl:wait(0)<br />
EightBox:resize(wx,wy+8,wh,ww)<br />
end<br />
Fl:wait(0)<br />
EightBox:resize(wx,wy,wh,ww)<br />
EightBox:redraw()<br />
AnswerOutput:value(EightBallAnswers[answer])<br />
end<br />
do EightBox= fltk:Fl_Double_Window(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, "MAGIC 8 BOX")<br />
EightBox:label(gLabelTable[#gLabelTable])<br />
EightBox:resize(509,283,362,119)<br />
<br />
do background= fltk:Fl_Box(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, "label")<br />
background:label(gLabelTable[#gLabelTable])<br />
background:resize(0,-1,365,237)<br />
background:box(fltk.FL_FLAT_BOX)<br />
background:color(0)<br />
end<br />
<br />
do ShakeButton= fltk:Fl_Button(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, "Shake")<br />
ShakeButton:label(gLabelTable[#gLabelTable])<br />
ShakeButton:callback(shakebox)<br />
ShakeButton:resize(0,75,365,45)<br />
ShakeButton:box(fltk.FL_NO_BOX)<br />
ShakeButton:labelfont(1)<br />
ShakeButton:labelsize(21)<br />
ShakeButton:labelcolor(1)<br />
end<br />
<br />
do AnswerOutput= fltk:Fl_Output(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, " ")<br />
AnswerOutput:label(gLabelTable[#gLabelTable])<br />
AnswerOutput:resize(20,16,325,39)<br />
AnswerOutput:box(fltk.FL_NO_BOX)<br />
AnswerOutput:textcolor(2)<br />
end<br />
end<br />
EightBox:show()<br />
Fl:run()<br />
<br />
]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Spelling/Typing Practice]]></title>
			<link>http://www.murga-projects.com/forum/showthread.php?tid=380</link>
			<pubDate>Sun, 18 Apr 2010 18:00:10 -0600</pubDate>
			<guid isPermaLink="false">http://www.murga-projects.com/forum/showthread.php?tid=380</guid>
			<description><![CDATA[Here's a program I made to allow my daughter to cheat through spelling classes.<br />
She's too good at both spelling and typing so this program made our days less of a drudgery.<br />
<br />
It looks for a file "spellingList.lua" which is a table that is broken down into Units that contain a list per unit. <br />
A quick and dirty Example would be:<br />
<br />
Code:<br />
spellingLists={{"global","solar"},{"pupil","community"}}<br />
<br />
<br />
For simplicity I've also included the table inside of the program itself so the external file isn't necessary. <br />
<br />
"Commonly mispelled words" might be a useful list  to use for adult practice. <br />
Or maybe a bunch of coding keywords to practice memorizing, I should probably make that.<br />
<br />
The code also writes to a file "CurrentUnitCurrentWord.txt", to keep track of progress so the user can pick up where they left off over many sessions.<br />
It also attempts to keep track of total time per session, as well as keystrokes, and words per minute typed.<br />
<br />
I've attached the Fluid file<br />
<br />
<br />
Code:<br />
spellingLists={{"global","solar"},{"pupil","community"}}<br />
&nbsp;&nbsp;listFile="spellingLists.lua"<br />
&nbsp;&nbsp;&nbsp;&nbsp;local sl=io.open(listFile,"r*")<br />
&nbsp;&nbsp;&nbsp;&nbsp;if sl~=nil then<br />
&nbsp;&nbsp;&nbsp;&nbsp;dofile(listFile)<br />
&nbsp;&nbsp;&nbsp;&nbsp;sl:close()<br />
&nbsp;&nbsp;&nbsp;&nbsp;end<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
currentUnit={}<br />
listCount = #spellingLists<br />
totalwords = 0<br />
for i = 1,listCount do <br />
currentUnit = spellingLists[i]<br />
unitCount = #currentUnit<br />
for ii = 1,unitCount do<br />
totalwords = totalwords + 1<br />
--print(currentUnit[ii])<br />
end<br />
end<br />
print(totalwords)<br />
<br />
keystrokeCount = 0<br />
totalLetters =0<br />
wordscompleted=0<br />
spellingTimerStart = os.time()<br />
TotalElapsedTime = 0<br />
UnitElapsedTime = 0<br />
wordsPerMinute = 0<br />
minuteCount = 0<br />
elapsedWordtime = 0<br />
wpmcount = 0<br />
unitDepth = 1<br />
listDepth = 1<br />
wordsPerMinute=0<br />
<br />
wordlistdepthfile = "CurrentUnitCurrentWord.txt"<br />
myFile = io.open(wordlistdepthfile,"r")<br />
if myFile ~= nil then<br />
dofile(wordlistdepthfile)<br />
myFile:close()<br />
end<br />
<br />
<br />
<br />
-- WriteSpellingListsToFile<br />
function WriteSpellingListsToFile()<br />
spellingListsFile = "spellingLists.lua"<br />
&nbsp;&nbsp;&nbsp;&nbsp;local f = io.open(spellingListsFile,"w")<br />
&nbsp;&nbsp;&nbsp;&nbsp;local Q = '"';<br />
&nbsp;&nbsp;&nbsp;&nbsp;local ba="{";<br />
&nbsp;&nbsp;&nbsp;&nbsp;local bb="}";<br />
&nbsp;&nbsp;&nbsp;&nbsp;local C=",";<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;if f ~= nil then <br />
&nbsp;&nbsp;&nbsp;&nbsp;local listout = ""<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for i = 1,#spellingLists do<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;local wordlist=""<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for ii = 1,#spellingLists[i] do<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wordlist=wordlist .. Q..spellingLists[i][ii]..Q..C <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;listout = listout..ba..string.sub(wordlist,1,-2)..bb..C.."&#92;n"<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;listwrite = "spellingLists="..ba..string.sub(listout,1,-3)..bb;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;f:write(listwrite)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;f:write(string.char (10))<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;io.close(f)<br />
&nbsp;&nbsp;&nbsp;&nbsp;end<br />
end<br />
-- WordInput_callback<br />
function WordInput_callback(w)<br />
wordtext = tostring(w:value())<br />
realword = WordInput:label()<br />
spellinglistWindow:make_current()<br />
keystrokeCount = keystrokeCount + 1<br />
<br />
if wordtext ~= realword then<br />
&nbsp;&nbsp;&nbsp;&nbsp;if string.sub(wordtext,-1,-1) == "." and string.len(wordtext)&gt;2 then<br />
&nbsp;&nbsp;&nbsp;&nbsp;realword = string.sub(wordtext,1,-2)<br />
&nbsp;&nbsp;&nbsp;&nbsp;wordtext = realworld<br />
&nbsp;&nbsp;&nbsp;&nbsp;spellingLists[unitDepth][listDepth] = realword<br />
&nbsp;&nbsp;&nbsp;&nbsp;WordInput:label("")&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;WordInput:label(realword)<br />
&nbsp;&nbsp;&nbsp;&nbsp;WordInput:replace(0,string.len(realword)+1,realword)<br />
&nbsp;&nbsp;&nbsp;&nbsp;WordInput:redraw()<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;WriteSpellingListsToFile()<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;end<br />
end<br />
<br />
if wordtext == realword then<br />
wordscompleted = wordscompleted + 1<br />
totalLetters = totalLetters + string.len(wordtext)<br />
&nbsp;&nbsp;&nbsp;&nbsp;listDepth = listDepth + 1<br />
&nbsp;&nbsp;&nbsp;&nbsp;if listDepth &gt; #spellingLists[unitDepth] then<br />
&nbsp;&nbsp;&nbsp;&nbsp;listDepth = 1<br />
&nbsp;&nbsp;&nbsp;&nbsp;unitDepth = unitDepth + 1<br />
&nbsp;&nbsp;&nbsp;&nbsp;if unitDepth &gt; #spellingLists then<br />
unitDepth=1<br />
end<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;UnitElapsedTime = 0<br />
&nbsp;&nbsp;&nbsp;&nbsp;end&nbsp;&nbsp;&nbsp;&nbsp;<br />
WordInput:label("")&nbsp;&nbsp;&nbsp;&nbsp;<br />
WordInput:label(spellingLists[unitDepth][listDepth])<br />
UnitLabel = "Unit "..tostring(unitDepth)<br />
<br />
WordInput:replace(0,string.len(wordtext),"")<br />
WordInput:redraw()<br />
wpmcount = wpmcount + 1<br />
<br />
<br />
<br />
whatText = "unitDepth="..unitDepth.."&#92;n".."listDepth="..listDepth.."&#92;n"<br />
myFile = io.open("CurrentUnitCurrentWord.txt","w")<br />
if myFile ~= nil then<br />
myFile:write(string.char (10))<br />
myFile:write(whatText)<br />
myFile:write(string.char (10))<br />
io.close(myFile)<br />
end <br />
<br />
elapsedWordtime = os.time() - spellingTimerStart&nbsp;&nbsp;<br />
spellingTimerStart = os.time()<br />
TotalElapsedTime = TotalElapsedTime + elapsedWordtime<br />
UnitElapsedTime = UnitElapsedTime + elapsedWordtime<br />
<br />
minuteCount = minuteCount + elapsedWordtime<br />
<br />
if minuteCount &gt; 60 then <br />
minuteCount = 0<br />
wordsPerMinute = wpmcount<br />
wpmcount = 0<br />
end<br />
<br />
InfoBrowser:clear()<br />
InfoBrowser:add(UnitLabel)<br />
InfoBrowser:add("Word "..listDepth.." of "..#spellingLists[unitDepth])<br />
InfoBrowser:add("Words Today: "..wordscompleted)<br />
InfoBrowser:add("Keystrokes: "..keystrokeCount.." for "..totalLetters)<br />
<br />
TimeBrowser:clear()<br />
TimeBrowser:add("Word time: "..elapsedWordtime)<br />
TimeBrowser:add("Unit Time: "..UnitElapsedTime)<br />
TimeBrowser:add("Total Time: "..TotalElapsedTime)<br />
TimeBrowser:add("WPM: "..wpmcount.."_"..minuteCount.." = "..wordsPerMinute)<br />
spellinglistWindow:redraw()<br />
<br />
end<br />
WordInput:redraw()<br />
<br />
<br />
end<br />
do spellinglistWindow= fltk:Fl_Double_Window(0,0,0,0,"")<br />
spellinglistWindow:callback(wClose)<br />
spellinglistWindow:resize(6,50,742,322)<br />
<br />
do fieldBackgrp= fltk:Fl_Group(0,0,0,0,"")<br />
fieldBackgrp:resize(0,0,740,320)<br />
fieldBackgrp:box(fltk.FL_DOWN_BOX)<br />
Fl_Group:current(Fl_Group:current():parent())<br />
end<br />
<br />
do InfoBrowser= fltk:Fl_Browser(0,0,0,0,"")<br />
InfoBrowser:resize(0,0,352,55)<br />
InfoBrowser:box(fltk.FL_FLAT_BOX)<br />
InfoBrowser:color(47)<br />
InfoBrowser:labelsize(10)<br />
InfoBrowser:textsize(10)<br />
end<br />
<br />
do TimeBrowser= fltk:Fl_Browser(0,0,0,0,"")<br />
TimeBrowser:resize(350,0,389,55)<br />
TimeBrowser:box(fltk.FL_FLAT_BOX)<br />
TimeBrowser:color(47)<br />
TimeBrowser:labelsize(10)<br />
TimeBrowser:textsize(10)<br />
end<br />
<br />
do WordInput= fltk:Fl_Input(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, "1234567890123")<br />
WordInput:label(gLabelTable[#gLabelTable])<br />
WordInput:callback(WordInput_callback)<br />
WordInput:resize(15,169,715,146)<br />
WordInput:color(55)<br />
WordInput:labelsize(94)<br />
WordInput:labelcolor(179)<br />
WordInput:align(5)<br />
WordInput:when(1)<br />
WordInput:textsize(70)<br />
end<br />
end<br />
spellinglistWindow:show()<br />
spellinglistWindow:make_current()<br />
WordInput:label(spellingLists[unitDepth][listDepth])<br />
UnitLabel= "Unit "..tostring(10+unitDepth)<br />
spellingTimerStart = os.time()<br />
elapsedWordtime = os.time() -spellingTimerStart <br />
TotalElapsedTime = TotalElapsedTime + elapsedWordtime<br />
UnitElapsedTime = UnitElapsedTime + elapsedWordtime<br />
InfoBrowser:clear()<br />
InfoBrowser:add(UnitLabel)<br />
InfoBrowser:add("Word "..listDepth.." of "..#spellingLists[unitDepth])<br />
InfoBrowser:add("Words Today: "..wordscompleted)<br />
InfoBrowser:add("Keystrokes: "..keystrokeCount.." for "..totalLetters)<br />
TimeBrowser:add("Word time: "..elapsedWordtime)<br />
TimeBrowser:add("Unit Time: "..UnitElapsedTime)<br />
TimeBrowser:add("Total Time: "..TotalElapsedTime)<br />
TimeBrowser:add("WPM: "..wpmcount.."_"..minuteCount.." = "..wordsPerMinute)<br />
spellinglistWindow:redraw()<br />
<br />
Fl:run()<br />
<br />
]]></description>
			<content:encoded><![CDATA[Here's a program I made to allow my daughter to cheat through spelling classes.<br />
She's too good at both spelling and typing so this program made our days less of a drudgery.<br />
<br />
It looks for a file "spellingList.lua" which is a table that is broken down into Units that contain a list per unit. <br />
A quick and dirty Example would be:<br />
<br />
Code:<br />
spellingLists={{"global","solar"},{"pupil","community"}}<br />
<br />
<br />
For simplicity I've also included the table inside of the program itself so the external file isn't necessary. <br />
<br />
"Commonly mispelled words" might be a useful list  to use for adult practice. <br />
Or maybe a bunch of coding keywords to practice memorizing, I should probably make that.<br />
<br />
The code also writes to a file "CurrentUnitCurrentWord.txt", to keep track of progress so the user can pick up where they left off over many sessions.<br />
It also attempts to keep track of total time per session, as well as keystrokes, and words per minute typed.<br />
<br />
I've attached the Fluid file<br />
<br />
<br />
Code:<br />
spellingLists={{"global","solar"},{"pupil","community"}}<br />
&nbsp;&nbsp;listFile="spellingLists.lua"<br />
&nbsp;&nbsp;&nbsp;&nbsp;local sl=io.open(listFile,"r*")<br />
&nbsp;&nbsp;&nbsp;&nbsp;if sl~=nil then<br />
&nbsp;&nbsp;&nbsp;&nbsp;dofile(listFile)<br />
&nbsp;&nbsp;&nbsp;&nbsp;sl:close()<br />
&nbsp;&nbsp;&nbsp;&nbsp;end<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
currentUnit={}<br />
listCount = #spellingLists<br />
totalwords = 0<br />
for i = 1,listCount do <br />
currentUnit = spellingLists[i]<br />
unitCount = #currentUnit<br />
for ii = 1,unitCount do<br />
totalwords = totalwords + 1<br />
--print(currentUnit[ii])<br />
end<br />
end<br />
print(totalwords)<br />
<br />
keystrokeCount = 0<br />
totalLetters =0<br />
wordscompleted=0<br />
spellingTimerStart = os.time()<br />
TotalElapsedTime = 0<br />
UnitElapsedTime = 0<br />
wordsPerMinute = 0<br />
minuteCount = 0<br />
elapsedWordtime = 0<br />
wpmcount = 0<br />
unitDepth = 1<br />
listDepth = 1<br />
wordsPerMinute=0<br />
<br />
wordlistdepthfile = "CurrentUnitCurrentWord.txt"<br />
myFile = io.open(wordlistdepthfile,"r")<br />
if myFile ~= nil then<br />
dofile(wordlistdepthfile)<br />
myFile:close()<br />
end<br />
<br />
<br />
<br />
-- WriteSpellingListsToFile<br />
function WriteSpellingListsToFile()<br />
spellingListsFile = "spellingLists.lua"<br />
&nbsp;&nbsp;&nbsp;&nbsp;local f = io.open(spellingListsFile,"w")<br />
&nbsp;&nbsp;&nbsp;&nbsp;local Q = '"';<br />
&nbsp;&nbsp;&nbsp;&nbsp;local ba="{";<br />
&nbsp;&nbsp;&nbsp;&nbsp;local bb="}";<br />
&nbsp;&nbsp;&nbsp;&nbsp;local C=",";<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;if f ~= nil then <br />
&nbsp;&nbsp;&nbsp;&nbsp;local listout = ""<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for i = 1,#spellingLists do<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;local wordlist=""<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for ii = 1,#spellingLists[i] do<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wordlist=wordlist .. Q..spellingLists[i][ii]..Q..C <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;listout = listout..ba..string.sub(wordlist,1,-2)..bb..C.."&#92;n"<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;listwrite = "spellingLists="..ba..string.sub(listout,1,-3)..bb;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;f:write(listwrite)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;f:write(string.char (10))<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;io.close(f)<br />
&nbsp;&nbsp;&nbsp;&nbsp;end<br />
end<br />
-- WordInput_callback<br />
function WordInput_callback(w)<br />
wordtext = tostring(w:value())<br />
realword = WordInput:label()<br />
spellinglistWindow:make_current()<br />
keystrokeCount = keystrokeCount + 1<br />
<br />
if wordtext ~= realword then<br />
&nbsp;&nbsp;&nbsp;&nbsp;if string.sub(wordtext,-1,-1) == "." and string.len(wordtext)&gt;2 then<br />
&nbsp;&nbsp;&nbsp;&nbsp;realword = string.sub(wordtext,1,-2)<br />
&nbsp;&nbsp;&nbsp;&nbsp;wordtext = realworld<br />
&nbsp;&nbsp;&nbsp;&nbsp;spellingLists[unitDepth][listDepth] = realword<br />
&nbsp;&nbsp;&nbsp;&nbsp;WordInput:label("")&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;WordInput:label(realword)<br />
&nbsp;&nbsp;&nbsp;&nbsp;WordInput:replace(0,string.len(realword)+1,realword)<br />
&nbsp;&nbsp;&nbsp;&nbsp;WordInput:redraw()<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;WriteSpellingListsToFile()<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;end<br />
end<br />
<br />
if wordtext == realword then<br />
wordscompleted = wordscompleted + 1<br />
totalLetters = totalLetters + string.len(wordtext)<br />
&nbsp;&nbsp;&nbsp;&nbsp;listDepth = listDepth + 1<br />
&nbsp;&nbsp;&nbsp;&nbsp;if listDepth &gt; #spellingLists[unitDepth] then<br />
&nbsp;&nbsp;&nbsp;&nbsp;listDepth = 1<br />
&nbsp;&nbsp;&nbsp;&nbsp;unitDepth = unitDepth + 1<br />
&nbsp;&nbsp;&nbsp;&nbsp;if unitDepth &gt; #spellingLists then<br />
unitDepth=1<br />
end<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;UnitElapsedTime = 0<br />
&nbsp;&nbsp;&nbsp;&nbsp;end&nbsp;&nbsp;&nbsp;&nbsp;<br />
WordInput:label("")&nbsp;&nbsp;&nbsp;&nbsp;<br />
WordInput:label(spellingLists[unitDepth][listDepth])<br />
UnitLabel = "Unit "..tostring(unitDepth)<br />
<br />
WordInput:replace(0,string.len(wordtext),"")<br />
WordInput:redraw()<br />
wpmcount = wpmcount + 1<br />
<br />
<br />
<br />
whatText = "unitDepth="..unitDepth.."&#92;n".."listDepth="..listDepth.."&#92;n"<br />
myFile = io.open("CurrentUnitCurrentWord.txt","w")<br />
if myFile ~= nil then<br />
myFile:write(string.char (10))<br />
myFile:write(whatText)<br />
myFile:write(string.char (10))<br />
io.close(myFile)<br />
end <br />
<br />
elapsedWordtime = os.time() - spellingTimerStart&nbsp;&nbsp;<br />
spellingTimerStart = os.time()<br />
TotalElapsedTime = TotalElapsedTime + elapsedWordtime<br />
UnitElapsedTime = UnitElapsedTime + elapsedWordtime<br />
<br />
minuteCount = minuteCount + elapsedWordtime<br />
<br />
if minuteCount &gt; 60 then <br />
minuteCount = 0<br />
wordsPerMinute = wpmcount<br />
wpmcount = 0<br />
end<br />
<br />
InfoBrowser:clear()<br />
InfoBrowser:add(UnitLabel)<br />
InfoBrowser:add("Word "..listDepth.." of "..#spellingLists[unitDepth])<br />
InfoBrowser:add("Words Today: "..wordscompleted)<br />
InfoBrowser:add("Keystrokes: "..keystrokeCount.." for "..totalLetters)<br />
<br />
TimeBrowser:clear()<br />
TimeBrowser:add("Word time: "..elapsedWordtime)<br />
TimeBrowser:add("Unit Time: "..UnitElapsedTime)<br />
TimeBrowser:add("Total Time: "..TotalElapsedTime)<br />
TimeBrowser:add("WPM: "..wpmcount.."_"..minuteCount.." = "..wordsPerMinute)<br />
spellinglistWindow:redraw()<br />
<br />
end<br />
WordInput:redraw()<br />
<br />
<br />
end<br />
do spellinglistWindow= fltk:Fl_Double_Window(0,0,0,0,"")<br />
spellinglistWindow:callback(wClose)<br />
spellinglistWindow:resize(6,50,742,322)<br />
<br />
do fieldBackgrp= fltk:Fl_Group(0,0,0,0,"")<br />
fieldBackgrp:resize(0,0,740,320)<br />
fieldBackgrp:box(fltk.FL_DOWN_BOX)<br />
Fl_Group:current(Fl_Group:current():parent())<br />
end<br />
<br />
do InfoBrowser= fltk:Fl_Browser(0,0,0,0,"")<br />
InfoBrowser:resize(0,0,352,55)<br />
InfoBrowser:box(fltk.FL_FLAT_BOX)<br />
InfoBrowser:color(47)<br />
InfoBrowser:labelsize(10)<br />
InfoBrowser:textsize(10)<br />
end<br />
<br />
do TimeBrowser= fltk:Fl_Browser(0,0,0,0,"")<br />
TimeBrowser:resize(350,0,389,55)<br />
TimeBrowser:box(fltk.FL_FLAT_BOX)<br />
TimeBrowser:color(47)<br />
TimeBrowser:labelsize(10)<br />
TimeBrowser:textsize(10)<br />
end<br />
<br />
do WordInput= fltk:Fl_Input(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, "1234567890123")<br />
WordInput:label(gLabelTable[#gLabelTable])<br />
WordInput:callback(WordInput_callback)<br />
WordInput:resize(15,169,715,146)<br />
WordInput:color(55)<br />
WordInput:labelsize(94)<br />
WordInput:labelcolor(179)<br />
WordInput:align(5)<br />
WordInput:when(1)<br />
WordInput:textsize(70)<br />
end<br />
end<br />
spellinglistWindow:show()<br />
spellinglistWindow:make_current()<br />
WordInput:label(spellingLists[unitDepth][listDepth])<br />
UnitLabel= "Unit "..tostring(10+unitDepth)<br />
spellingTimerStart = os.time()<br />
elapsedWordtime = os.time() -spellingTimerStart <br />
TotalElapsedTime = TotalElapsedTime + elapsedWordtime<br />
UnitElapsedTime = UnitElapsedTime + elapsedWordtime<br />
InfoBrowser:clear()<br />
InfoBrowser:add(UnitLabel)<br />
InfoBrowser:add("Word "..listDepth.." of "..#spellingLists[unitDepth])<br />
InfoBrowser:add("Words Today: "..wordscompleted)<br />
InfoBrowser:add("Keystrokes: "..keystrokeCount.." for "..totalLetters)<br />
TimeBrowser:add("Word time: "..elapsedWordtime)<br />
TimeBrowser:add("Unit Time: "..UnitElapsedTime)<br />
TimeBrowser:add("Total Time: "..TotalElapsedTime)<br />
TimeBrowser:add("WPM: "..wpmcount.."_"..minuteCount.." = "..wordsPerMinute)<br />
spellinglistWindow:redraw()<br />
<br />
Fl:run()<br />
<br />
]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[PsychoLua-gist]]></title>
			<link>http://www.murga-projects.com/forum/showthread.php?tid=379</link>
			<pubDate>Sun, 18 Apr 2010 17:42:26 -0600</pubDate>
			<guid isPermaLink="false">http://www.murga-projects.com/forum/showthread.php?tid=379</guid>
			<description><![CDATA[A really dumb psychology simulator.<br />
Derived from  psychic-ologist (for BASIC) by Nathan Wittich <br />
<br />
<br />
Code:<br />
score={{}}<br />
score["learnstrings"]={}<br />
AI_RESPONSE={"what does that make you think?"<br />
,&nbsp;&nbsp;"have you thought much about the end result of that?"<br />
,&nbsp;&nbsp;"maybe we should talk about something else."<br />
,&nbsp;&nbsp;"you realize I only listen to you since it's my job. But go on."<br />
,&nbsp;&nbsp;"if that's entirely true, you would have made more of a point."<br />
,&nbsp;&nbsp;"pretending you are your guardian angel, tell me your opinion."<br />
,&nbsp;&nbsp;"what if you were to walk off a cliff today?"<br />
,&nbsp;&nbsp;"are you aware of your surroundings much?"<br />
,&nbsp;&nbsp;"if you were, you'd understand I might not be"<br />
,&nbsp;&nbsp;"time for you to get a break for a while."<br />
,&nbsp;&nbsp;"how come you always say dumb responses?"<br />
,&nbsp;&nbsp;"You come here to share your problems with me."<br />
,&nbsp;&nbsp;"Is there something I should know?"<br />
,&nbsp;&nbsp;"maybe you should tell me things in more detail."<br />
,&nbsp;&nbsp;"Is that really the reason?"<br />
,&nbsp;&nbsp;"do you even trust me?"<br />
,&nbsp;&nbsp;"It's OK. I understand. It's my job to understand. My job is to help you."<br />
,&nbsp;&nbsp;"more secrets, less mumbo-jumbo, OK."<br />
,&nbsp;&nbsp;"I don't know why I even try. Wait, I do, It's my job."<br />
,&nbsp;&nbsp;"Is there something you'd rather be talking about?"<br />
,&nbsp;&nbsp;"I look like this :-) but even us psychologists lie."<br />
,&nbsp;&nbsp;"You know what I think?"<br />
,&nbsp;&nbsp;"There was a cat that wore a hat and sat on mat and it was fat and that was that."<br />
,&nbsp;&nbsp;"You need a vacation."<br />
,&nbsp;&nbsp;"There's a pot of gold at the end of every rainbow."<br />
,&nbsp;&nbsp;"When is groundhog day?"<br />
,&nbsp;&nbsp;"You need to look at the big picture."<br />
,&nbsp;&nbsp;"what was accomplished?"<br />
,&nbsp;&nbsp;"You should be more assertive"<br />
,&nbsp;&nbsp;"You should finish something"<br />
,&nbsp;&nbsp;"Don't you even pay attention to your instincts? They're there to help you."<br />
,&nbsp;&nbsp;"You don't understand how others see you"<br />
,&nbsp;&nbsp;"What's your ultimate goal?"<br />
,&nbsp;&nbsp;"You tend to concentrate too much on one thing and forget another thing: Comb hair, ignore teeth. You're nice, but think too fast..."<br />
,&nbsp;&nbsp;"Do you try many new things?"<br />
,&nbsp;&nbsp;"Want my advice? Take a philosphy class."<br />
,&nbsp;&nbsp;"I think your dog understands you better than most people."}<br />
<br />
math.randomseed(os.time()) ; -- RANDOMIZE TIMER<br />
<br />
<br />
function listTableForOutput(TableName)<br />
&nbsp;&nbsp;&nbsp;&nbsp;local Q = '"';<br />
&nbsp;&nbsp;&nbsp;&nbsp;local ba="{";<br />
&nbsp;&nbsp;&nbsp;&nbsp;local bb="}";<br />
&nbsp;&nbsp;&nbsp;&nbsp;local C=",";<br />
<br />
local listout = ""<br />
local scoreword={}<br />
local wordlist=""<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for i = 1,#score[TableName],1 do<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;scoreword=score[TableName][i]&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;qfind = string.find(scoreword,Q)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if qfind == nil then<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;scoreword=Q..scoreword..Q<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;listout = listout..scoreword..C<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; scoreout="&#92;n".."score["..Q..TableName..Q.."]="..ba..string.sub(listout,1,-2)..bb;<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;return scoreout&nbsp;&nbsp;&nbsp;&nbsp;<br />
end<br />
<br />
function WriteTablesToFile()<br />
tableListsFile = "psycholuagist_learn.lua"<br />
&nbsp;&nbsp;&nbsp;&nbsp;local f = io.open(tableListsFile,"w")<br />
&nbsp;&nbsp;&nbsp;&nbsp;local Q = '"';<br />
&nbsp;&nbsp;&nbsp;&nbsp;local ba="{";<br />
&nbsp;&nbsp;&nbsp;&nbsp;local bb="}";<br />
&nbsp;&nbsp;&nbsp;&nbsp;local C=",";<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;if f ~= nil then <br />
&nbsp;&nbsp;&nbsp;&nbsp;listwrite="&#92;n"<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;listwrite = listwrite.."&#92;n"..listTableForOutput("learnstrings")<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;f:write(listwrite)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;f:write(string.char (10))<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;io.close(f)<br />
&nbsp;&nbsp;&nbsp;&nbsp;end<br />
end<br />
<br />
<br />
helloText=[[ Hello. <br />
Welcome to psycholua-gist by William Griffin<br />
Derived from&nbsp;&nbsp;psychic-ologist (for BASIC) by Nathan Wittich <br />
<br />
This 'Artificial inteligence' will talk to you.<br />
 Note: if something doesn't directly make sense, It may <br />
 be sort of symbolic or something.<br />
<br />
Also, you have to act human for me to act human. <br />
For example, if a human says something twice, <br />
you say 'you already said that' not 'you're stupid'.<br />
<br />
Also note: you don't have to answer.]]<br />
<br />
print(helloText)<br />
<br />
<br />
<br />
function psychoLuagist()<br />
&nbsp;&nbsp;&nbsp;&nbsp;local input<br />
&nbsp;&nbsp;&nbsp;&nbsp;local ps1 = ps1 or "&gt; "<br />
&nbsp;&nbsp;&nbsp;&nbsp;while true do<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;io.stdout:write(ps1)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;input = io.stdin:read(); --LINE INPUT "", a&#36;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if not input then io.stdout:write('&#92;n') return end<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; g = "&nbsp;&nbsp;"..AI_RESPONSE[math.random(1,#AI_RESPONSE)] ; -- g&#36; = n&#36;(1 + INT(RND * a))&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print(g) <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;table.insert(score["learnstrings"],input)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;WriteTablesToFile()<br />
&nbsp;&nbsp;&nbsp;&nbsp;end<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
end<br />
psychoLuagist()<br />
<br />
]]></description>
			<content:encoded><![CDATA[A really dumb psychology simulator.<br />
Derived from  psychic-ologist (for BASIC) by Nathan Wittich <br />
<br />
<br />
Code:<br />
score={{}}<br />
score["learnstrings"]={}<br />
AI_RESPONSE={"what does that make you think?"<br />
,&nbsp;&nbsp;"have you thought much about the end result of that?"<br />
,&nbsp;&nbsp;"maybe we should talk about something else."<br />
,&nbsp;&nbsp;"you realize I only listen to you since it's my job. But go on."<br />
,&nbsp;&nbsp;"if that's entirely true, you would have made more of a point."<br />
,&nbsp;&nbsp;"pretending you are your guardian angel, tell me your opinion."<br />
,&nbsp;&nbsp;"what if you were to walk off a cliff today?"<br />
,&nbsp;&nbsp;"are you aware of your surroundings much?"<br />
,&nbsp;&nbsp;"if you were, you'd understand I might not be"<br />
,&nbsp;&nbsp;"time for you to get a break for a while."<br />
,&nbsp;&nbsp;"how come you always say dumb responses?"<br />
,&nbsp;&nbsp;"You come here to share your problems with me."<br />
,&nbsp;&nbsp;"Is there something I should know?"<br />
,&nbsp;&nbsp;"maybe you should tell me things in more detail."<br />
,&nbsp;&nbsp;"Is that really the reason?"<br />
,&nbsp;&nbsp;"do you even trust me?"<br />
,&nbsp;&nbsp;"It's OK. I understand. It's my job to understand. My job is to help you."<br />
,&nbsp;&nbsp;"more secrets, less mumbo-jumbo, OK."<br />
,&nbsp;&nbsp;"I don't know why I even try. Wait, I do, It's my job."<br />
,&nbsp;&nbsp;"Is there something you'd rather be talking about?"<br />
,&nbsp;&nbsp;"I look like this :-) but even us psychologists lie."<br />
,&nbsp;&nbsp;"You know what I think?"<br />
,&nbsp;&nbsp;"There was a cat that wore a hat and sat on mat and it was fat and that was that."<br />
,&nbsp;&nbsp;"You need a vacation."<br />
,&nbsp;&nbsp;"There's a pot of gold at the end of every rainbow."<br />
,&nbsp;&nbsp;"When is groundhog day?"<br />
,&nbsp;&nbsp;"You need to look at the big picture."<br />
,&nbsp;&nbsp;"what was accomplished?"<br />
,&nbsp;&nbsp;"You should be more assertive"<br />
,&nbsp;&nbsp;"You should finish something"<br />
,&nbsp;&nbsp;"Don't you even pay attention to your instincts? They're there to help you."<br />
,&nbsp;&nbsp;"You don't understand how others see you"<br />
,&nbsp;&nbsp;"What's your ultimate goal?"<br />
,&nbsp;&nbsp;"You tend to concentrate too much on one thing and forget another thing: Comb hair, ignore teeth. You're nice, but think too fast..."<br />
,&nbsp;&nbsp;"Do you try many new things?"<br />
,&nbsp;&nbsp;"Want my advice? Take a philosphy class."<br />
,&nbsp;&nbsp;"I think your dog understands you better than most people."}<br />
<br />
math.randomseed(os.time()) ; -- RANDOMIZE TIMER<br />
<br />
<br />
function listTableForOutput(TableName)<br />
&nbsp;&nbsp;&nbsp;&nbsp;local Q = '"';<br />
&nbsp;&nbsp;&nbsp;&nbsp;local ba="{";<br />
&nbsp;&nbsp;&nbsp;&nbsp;local bb="}";<br />
&nbsp;&nbsp;&nbsp;&nbsp;local C=",";<br />
<br />
local listout = ""<br />
local scoreword={}<br />
local wordlist=""<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for i = 1,#score[TableName],1 do<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;scoreword=score[TableName][i]&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;qfind = string.find(scoreword,Q)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if qfind == nil then<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;scoreword=Q..scoreword..Q<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;listout = listout..scoreword..C<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; scoreout="&#92;n".."score["..Q..TableName..Q.."]="..ba..string.sub(listout,1,-2)..bb;<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;return scoreout&nbsp;&nbsp;&nbsp;&nbsp;<br />
end<br />
<br />
function WriteTablesToFile()<br />
tableListsFile = "psycholuagist_learn.lua"<br />
&nbsp;&nbsp;&nbsp;&nbsp;local f = io.open(tableListsFile,"w")<br />
&nbsp;&nbsp;&nbsp;&nbsp;local Q = '"';<br />
&nbsp;&nbsp;&nbsp;&nbsp;local ba="{";<br />
&nbsp;&nbsp;&nbsp;&nbsp;local bb="}";<br />
&nbsp;&nbsp;&nbsp;&nbsp;local C=",";<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;if f ~= nil then <br />
&nbsp;&nbsp;&nbsp;&nbsp;listwrite="&#92;n"<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;listwrite = listwrite.."&#92;n"..listTableForOutput("learnstrings")<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;f:write(listwrite)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;f:write(string.char (10))<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;io.close(f)<br />
&nbsp;&nbsp;&nbsp;&nbsp;end<br />
end<br />
<br />
<br />
helloText=[[ Hello. <br />
Welcome to psycholua-gist by William Griffin<br />
Derived from&nbsp;&nbsp;psychic-ologist (for BASIC) by Nathan Wittich <br />
<br />
This 'Artificial inteligence' will talk to you.<br />
 Note: if something doesn't directly make sense, It may <br />
 be sort of symbolic or something.<br />
<br />
Also, you have to act human for me to act human. <br />
For example, if a human says something twice, <br />
you say 'you already said that' not 'you're stupid'.<br />
<br />
Also note: you don't have to answer.]]<br />
<br />
print(helloText)<br />
<br />
<br />
<br />
function psychoLuagist()<br />
&nbsp;&nbsp;&nbsp;&nbsp;local input<br />
&nbsp;&nbsp;&nbsp;&nbsp;local ps1 = ps1 or "&gt; "<br />
&nbsp;&nbsp;&nbsp;&nbsp;while true do<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;io.stdout:write(ps1)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;input = io.stdin:read(); --LINE INPUT "", a&#36;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if not input then io.stdout:write('&#92;n') return end<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; g = "&nbsp;&nbsp;"..AI_RESPONSE[math.random(1,#AI_RESPONSE)] ; -- g&#36; = n&#36;(1 + INT(RND * a))&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print(g) <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;table.insert(score["learnstrings"],input)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;WriteTablesToFile()<br />
&nbsp;&nbsp;&nbsp;&nbsp;end<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
end<br />
psychoLuagist()<br />
<br />
]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Math Machine]]></title>
			<link>http://www.murga-projects.com/forum/showthread.php?tid=378</link>
			<pubDate>Sun, 18 Apr 2010 17:33:12 -0600</pubDate>
			<guid isPermaLink="false">http://www.murga-projects.com/forum/showthread.php?tid=378</guid>
			<description><![CDATA[This is a little math quiz program I made for my daughter. She home schools.<br />
With pencil and paper math assignments she'll take 30 minutes for 10 problems, but with this little program she rips through 200 problems in the same time.<br />
<br />
The program only deals with integer math and positive numbers.<br />
The program solves division problems by first multiplying the variables, and providing the answer of the multiplication as a fraction.<br />
It also plays switcheroo with subtraction problems to avoid negative answers.<br />
<br />
The Options tab sets the level of difficulty of the math problems.<br />
<br />
The program writes a record of progress to a file "MathRecords.lua", currently at the root or home directory (depending on how the program is run), you can of course change that in the code.<br />
<br />
I've attached the Fluid file.<br />
<br />
<br />
Code:<br />
rndMinTop=1<br />
rndMinBottom=1<br />
<br />
rndMaxTop=11<br />
rndMaxBottom=11<br />
<br />
rndProcessOption=4<br />
<br />
o1=math.random(rndMinTop,rndMaxTop)<br />
o2=math.random(rndMinBottom,rndMaxBottom)<br />
o3=math.random(1,rndProcessOption)<br />
o4=0<br />
<br />
answervalue=0<br />
<br />
score={{}}<br />
score["answer"]= {}<br />
score["correct"]=""<br />
score["tries"]=""<br />
<br />
score["multiplication"]={}<br />
score["division"]={}<br />
score["subtraction"]={}<br />
score["addition"]={}<br />
<br />
<br />
mathRecords={}<br />
<br />
<br />
local Q = '"';<br />
local ba="{";<br />
local bb="}";<br />
local C=",";<br />
<br />
<br />
score["correct"]=1<br />
score["tries"]=1<br />
score["addition"]={"1,1,1,2"}<br />
score["subtraction"]={"1,1,2,0"}<br />
score["multiplication"]={"1,1,3,1"}<br />
score["division"]={"1,1,4,1"}<br />
currentUnit={}<br />
listCount = 0; --#mathList<br />
totalwords = 0<br />
keystrokeCount = 0<br />
totalLetters =0<br />
wordscompleted=0<br />
spellingTimerStart = os.time()<br />
TotalElapsedTime = 0<br />
UnitElapsedTime = 0<br />
wordsPerMinute = 0<br />
minuteCount = 0<br />
elapsedWordtime = 0<br />
wpmcount = 0<br />
unitDepth = 1<br />
listDepth = 1<br />
wordsPerMinute=0<br />
-- "len": the # operation.<br />
function len_event (op)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if type(op) == "string" then<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return strlen(op)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -- primitive string length<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; elseif type(op) == "table" then<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return #op&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-- primitive table length<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; local h = metatable(op).__len<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if h then<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -- call the handler with the operand<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return (h(op))<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else&nbsp;&nbsp;-- no handler available: default behavior<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; error()<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; end<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; end<br />
&nbsp;&nbsp;&nbsp;&nbsp; end<br />
function getLocations(o1,o2,o3)<br />
<br />
<br />
--TOP<br />
--hundredsplacebox<br />
hptx,hpty = hundredsplaceT:x(),hundredsplaceT:y()<br />
hptw,hpth = hundredsplaceT:w(),hundredsplaceT:h()<br />
--tensplacebox<br />
tptx,tpty = tensplaceT:x(),tensplaceT:y()<br />
tptw,tpth = tensplaceT:w(),tensplaceT:h()<br />
--onesplacebox<br />
optx,opty = onesplaceT:x(),onesplaceT:y()<br />
optw,opth = onesplaceT:w(),onesplaceT:h()<br />
if o1 &lt; 10 then <br />
output1:resize(optx,opty,hptw,hpth)<br />
end<br />
if o1 &gt;= 10 and o1 &lt; 100 then<br />
output1:resize(tptx,tpty ,tptw,tpth)<br />
end<br />
if o1 &gt;= 100 and o1 &lt; 1000 then<br />
output1:resize(hptx,hpty,hptw,hpth)<br />
end<br />
<br />
<br />
<br />
--BOTTOM<br />
--hundredsplacebox<br />
hpbx,hpby = hundredsplaceB:x(),hundredsplaceB:y()<br />
hpbw,hpbh = hundredsplaceB:w(),hundredsplaceB:h()<br />
--tensplacebox<br />
tpbx,tpby = tensplaceB:x(),tensplaceB:y()<br />
tpbw,tpbh = tensplaceB:w(),tensplaceB:h()<br />
--onesplacebox<br />
opbx,opby = onesplaceB:x(),onesplaceB:y()<br />
opbw,opbh = onesplaceB:w(),onesplaceB:h()<br />
o3w,o3h = output3:w(),output3:h()<br />
--DIVISION<br />
--hundredsplacebox<br />
hpdx,hpdy = hundredsplaceD:x(),hundredsplaceD:y()<br />
hpdw,hpdh = hundredsplaceD:w(),hundredsplaceD:h()<br />
--tensplacebox<br />
tpdx,tpdy = tensplaceD:x(),tensplaceD:y()<br />
tpdw,tpdh = tensplaceD:w(),tensplaceD:h()<br />
--onesplacebox<br />
opdx,opdy = onesplaceD:x(),onesplaceD:y()<br />
opdw,opdh = onesplaceD:w(),onesplaceD:h()<br />
<br />
if o2 &lt; 10 then <br />
output2:resize(opbx,opby,hpbw,hpbh)<br />
output3:resize((opbx-o3w),opby,o3w,o3h)<br />
output2b:resize(opdx,opdy,hpbw,hpdh)<br />
end<br />
if o2 &gt;= 10 and o2 &lt; 100 then<br />
output2:resize(tpbx,tpby ,tpbw,tpbh)<br />
output3:resize((tpbx-o3w),opby,o3w,o3h)<br />
output2b:resize(tpdx,tpdy ,tpdw,tpdh)<br />
end<br />
if o2 &gt;= 100 and o2 &lt; 1000 then<br />
output2:resize(hpbx,hpby,hpbw,hpbh)<br />
output3:resize((hpbx-o3w),opby,o3w,o3h)<br />
output2b:resize(hpdx,hpdy,hpbw,hpdh)<br />
end<br />
end<br />
<br />
function listScoreForOutput(TableName)<br />
&nbsp;&nbsp;&nbsp;&nbsp;local Q = '"';<br />
&nbsp;&nbsp;&nbsp;&nbsp;local ba="{";<br />
&nbsp;&nbsp;&nbsp;&nbsp;local bb="}";<br />
&nbsp;&nbsp;&nbsp;&nbsp;local C=",";<br />
<br />
local listout = ""<br />
local scoreword={}<br />
local wordlist=""<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for i = 1,#score[TableName],1 do<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;scoreword=score[TableName][i]&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;qfind = string.find(scoreword,Q)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if qfind == nil then<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;scoreword=Q..scoreword..Q<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;listout = listout..scoreword..C<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; scoreout="&#92;n".."score["..Q..TableName..Q.."]="..ba..string.sub(listout,1,-2)..bb;<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;return scoreout&nbsp;&nbsp;&nbsp;&nbsp;<br />
end<br />
function updateMaxMin()<br />
rndMinTop=mincountertop:value()<br />
rndMinBottom=mincounterbottom:value()<br />
rndMaxTop=maxcountertop:value()<br />
rndMaxBottom=maxcounterbottom:value()<br />
return rndMinTop,rndMinBottom,rndMaxTop,rndMaxBottom<br />
end<br />
function updateProcessOptions()<br />
<br />
end<br />
function updateProgressValues()<br />
currentcorrect = score["correct"] <br />
currenttries = score["tries"]<br />
<br />
daybar:value(dailypercent)<br />
daybar:label(dailypercent.." today")<br />
<br />
dailypercentupvalue=( currentcorrect / currenttries )*100<br />
correctbar:value(dailypercentupvalue)<br />
correctbar:label("Proficiency: "..dailypercentupvalue)<br />
<br />
monthlypercent=(currentcorrect)/200<br />
yearlypercent=(currentcorrect)/1720<br />
currentpercent=((currentcorrect)/10)*100<br />
<br />
--output4:value(currentcorrect)<br />
--output5:value(currenttries)<br />
<br />
<br />
yearbar:value((1720-currentcorrect))<br />
yearbar:label(currentcorrect.." of 1720")<br />
<br />
sc=score["correct"]<br />
st=score["tries"]<br />
MathWindow:label(sc.." correct of "..st.." tries".." | Proficiency:"..dailypercentupvalue.." | 1720")<br />
<br />
end<br />
function openMathRecords()<br />
listFile="mathRecord.lua"<br />
&nbsp;&nbsp;&nbsp;&nbsp;local sl=io.open(listFile,"r*")<br />
&nbsp;&nbsp;&nbsp;&nbsp;if sl~=nil then<br />
&nbsp;&nbsp;&nbsp;&nbsp;dofile(listFile)<br />
&nbsp;&nbsp;&nbsp;&nbsp;sl:close()<br />
&nbsp;&nbsp;&nbsp;&nbsp;end<br />
&nbsp;&nbsp;&nbsp;&nbsp;return score["correct"]&nbsp;&nbsp;&nbsp;&nbsp;<br />
end<br />
function openCurrentMathProgress()<br />
wordlistdepthfile = "CurrentMathProgress.txt"<br />
myFile = io.open(wordlistdepthfile,"r")<br />
if myFile ~= nil then<br />
 dofile(wordlistdepthfile)<br />
 myFile:close()<br />
end<br />
end<br />
function WriteMathListsToFile()<br />
mathListsFile = "mathRecord.lua"<br />
&nbsp;&nbsp;&nbsp;&nbsp;local f = io.open(mathListsFile,"w")<br />
&nbsp;&nbsp;&nbsp;&nbsp;local Q = '"';<br />
&nbsp;&nbsp;&nbsp;&nbsp;local ba="{";<br />
&nbsp;&nbsp;&nbsp;&nbsp;local bb="}";<br />
&nbsp;&nbsp;&nbsp;&nbsp;local C=",";<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;if f ~= nil then <br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;correct=score["correct"]<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tries=score["tries"]<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;listwrite="&#92;n"<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;listwrite = listwrite.."&#92;n"..listScoreForOutput("addition")<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;listwrite = listwrite.."&#92;n"..listScoreForOutput("subtraction")<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;listwrite = listwrite.."&#92;n"..listScoreForOutput("multiplication")<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;listwrite = listwrite.."&#92;n"..listScoreForOutput("division")<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;listwrite = listwrite.."&#92;n".."score["..Q.."correct"..Q.."]="..correct..";&#92;n";<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;listwrite = listwrite.."&#92;n".."score["..Q.."tries"..Q.."]="..tries..";&#92;n";<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;f:write(listwrite)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;f:write(string.char (10))<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;io.close(f)<br />
&nbsp;&nbsp;&nbsp;&nbsp;end<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
end<br />
function progressdaily()<br />
progbar:minimum(0)<br />
progbar:maximum(100) <br />
end<br />
function randomize()<br />
o1=math.random(rndMinTop,rndMaxTop)<br />
o2=math.random(rndMinBottom,rndMaxBottom)<br />
<br />
<br />
o3=math.random(1,rndProcessOption)<br />
<br />
<br />
o4=0<br />
return o1,o2,o3<br />
end<br />
function answerproblem(o1,o2,o3,answervalue)<br />
<br />
<br />
mathsigns={"+","-","/","*","^"}<br />
<br />
-- addition<br />
if o3 == 1 then answervalue = o1 + o2 end<br />
<br />
-- multiplication<br />
if o3 == 4 then answervalue = o1 * o2 end<br />
<br />
-- handle subtraction without negative values<br />
if o3 == 2 then <br />
&nbsp;&nbsp;&nbsp;&nbsp;if o1 &lt; o2 then <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;hold1 = o1<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ol = o2<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;o2 = hold1<br />
&nbsp;&nbsp;&nbsp;&nbsp;end<br />
&nbsp;&nbsp;&nbsp;&nbsp;answervalue = o1 - o2 <br />
end<br />
<br />
-- handle fractions as divisions<br />
&nbsp;&nbsp;&nbsp;&nbsp;if o3 == 3 then&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;subtotal = o1 * o2 <br />
&nbsp;&nbsp;&nbsp;&nbsp;answervalue = o1<br />
&nbsp;&nbsp;&nbsp;&nbsp;o1=subtotal<br />
&nbsp;&nbsp;&nbsp;&nbsp;fractionbar:show()<br />
&nbsp;&nbsp;&nbsp;&nbsp;divisiongroup:show()<br />
&nbsp;&nbsp;&nbsp;&nbsp;output3:label("Divide")<br />
&nbsp;&nbsp;&nbsp;&nbsp;output2b:value(o2)<br />
&nbsp;&nbsp;&nbsp;&nbsp;output1b:value(o1)<br />
&nbsp;&nbsp;&nbsp;&nbsp;output2c:value(o2)<br />
&nbsp;&nbsp;&nbsp;&nbsp;output1c:value(o1)<br />
&nbsp;&nbsp;&nbsp;&nbsp;else<br />
&nbsp;&nbsp;&nbsp;&nbsp;divisiongroup:hide()<br />
&nbsp;&nbsp;&nbsp;&nbsp;output3:label(" ")<br />
&nbsp;&nbsp;&nbsp;&nbsp;fractionbar:hide()<br />
&nbsp;&nbsp;&nbsp;&nbsp;end<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
output1:value(o1)<br />
output2:value(o2)<br />
output3:value(mathsigns[o3])<br />
<br />
<br />
<br />
getLocations(o1,o2,o3)<br />
<br />
answeroutput:value(answervalue)<br />
alloutputs = o1..","..o2..","..o3..","..answervalue<br />
<br />
return o1,o2,o3,answervalue<br />
end<br />
function checkanswer(w)<br />
local tried=score["tries"]<br />
<br />
if AnswerCheck:value() ~= nil then <br />
alloutputs = Q..o1..output3:value()..o2.."="..answeroutput:value()..Q<br />
tried=tried+1<br />
score["tries"]=tried<br />
<br />
end<br />
<br />
alloutputs = Q..o1..","..o2..","..o3..","..answeroutput:value()..Q<br />
<br />
--if the entered value equals correct answer<br />
if w:value() == answeroutput:value() then<br />
dailypercent=dailypercent +1<br />
score["correct"]=score["correct"]+1&nbsp;&nbsp;&nbsp;&nbsp;<br />
<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;if o3 == 1 then <br />
&nbsp;&nbsp;&nbsp;&nbsp;alloutputs = Q..o1..","..o2..","..answeroutput:value()..Q<br />
&nbsp;&nbsp;&nbsp;&nbsp;table.insert(score["addition"], alloutputs)<br />
&nbsp;&nbsp;&nbsp;&nbsp;end<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;if o3 == 2 then <br />
&nbsp;&nbsp;&nbsp;&nbsp;alloutputs = Q..o1..","..o2..","..answeroutput:value()..Q<br />
&nbsp;&nbsp;&nbsp;&nbsp;table.insert(score["subtraction"], alloutputs)<br />
&nbsp;&nbsp;&nbsp;&nbsp;end<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;if o3 == 3 then <br />
&nbsp;&nbsp;&nbsp;&nbsp;alloutputs = Q..o1..","..o2..","..answeroutput:value()..Q<br />
&nbsp;&nbsp;&nbsp;&nbsp;table.insert(score["multiplication"], alloutputs)<br />
&nbsp;&nbsp;&nbsp;&nbsp;end<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;if o3 == 4 then <br />
&nbsp;&nbsp;&nbsp;&nbsp;alloutputs = Q..o1..","..o2..","..answeroutput:value()..Q<br />
&nbsp;&nbsp;&nbsp;&nbsp;table.insert(score["division"], alloutputs)<br />
&nbsp;&nbsp;&nbsp;&nbsp;end<br />
<br />
<br />
<br />
rndMinTop,rndMinBottom,rndMaxTop,rndMaxBottom=updateMaxMin()<br />
o1,o2,o3,answervalue = answerproblem(randomize(rndMinTop,rndMaxBottom,4))<br />
w:value("")<br />
save()<br />
end<br />
<br />
updateProgressValues()<br />
<br />
<br />
MathWindow:redraw()<br />
MathWindow:make_current()<br />
end<br />
function cycleproblems()<br />
<br />
<br />
o1,o2,o3,answervalue = answerproblem(randomize(rndMaxTop,rndMaxBottom,rndProcessOption))<br />
<br />
<br />
MathWindow:redraw()<br />
MathWindow:make_current()<br />
end<br />
function save()<br />
WriteMathListsToFile()<br />
end<br />
if MathWindow ~= nil then MathWindow:hide() end<br />
do MathWindow= fltk:Fl_Double_Window(0,0,0,0,"")<br />
MathWindow:resize(63,50,965,721)<br />
MathWindow:color(0)<br />
--MathWindow:show()<br />
do HiddenGroup= fltk:Fl_Group(0,0,0,0,"")<br />
HiddenGroup:resize(15,5,1410,630)<br />
--unknown attribute: hide<br />
--unknown attribute: deactivate<br />
do output6= fltk:Fl_Output(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, "=")<br />
output6:label(gLabelTable[#gLabelTable])<br />
output6:resize(1105,14,150,17)<br />
output6:color(31)<br />
output6:labelsize(12)<br />
output6:labelcolor(7)<br />
output6:align(36)<br />
output6:textcolor(7)<br />
end<br />
<br />
do NextButton= fltk:Fl_Button(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, "NEXT")<br />
NextButton:label(gLabelTable[#gLabelTable])<br />
NextButton:callback(cycleproblems)<br />
NextButton:resize(1270,15,60,15)<br />
NextButton:labelsize(12)<br />
end<br />
<br />
do Save= fltk:Fl_Button(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, "Save")<br />
Save:label(gLabelTable[#gLabelTable])<br />
Save:callback(save)<br />
Save:resize(1335,15,60,15)<br />
--unknown attribute: deactivate<br />
end<br />
<br />
do output4= fltk:Fl_Output(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, "Correct of:")<br />
output4:label(gLabelTable[#gLabelTable])<br />
output4:resize(15,616,25,19)<br />
output4:box(fltk.FL_NO_BOX)<br />
output4:color(31)<br />
output4:labelsize(10)<br />
output4:labelcolor(62)<br />
output4:align(40)<br />
output4:textsize(10)<br />
output4:textcolor(62)<br />
end<br />
<br />
do output5= fltk:Fl_Output(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, "Tries")<br />
output5:label(gLabelTable[#gLabelTable])<br />
output5:resize(90,616,25,19)<br />
output5:box(fltk.FL_NO_BOX)<br />
output5:color(31)<br />
output5:labelsize(10)<br />
output5:labelcolor(62)<br />
output5:align(40)<br />
output5:textsize(10)<br />
output5:textcolor(62)<br />
end<br />
Fl_Group:current(Fl_Group:current():parent())<br />
end<br />
<br />
do NumPositionGroup= fltk:Fl_Group(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, "NumPositionGroup")<br />
NumPositionGroup:label(gLabelTable[#gLabelTable])<br />
NumPositionGroup:resize(173,108,459,424)<br />
<br />
do onesplaceT= fltk:Fl_Box(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, "onesplace")<br />
onesplaceT:label(gLabelTable[#gLabelTable])<br />
onesplaceT:resize(525,116,72,89)<br />
onesplaceT:box(fltk.FL_UP_FRAME)<br />
onesplaceT:color(6)<br />
end<br />
<br />
do tensplaceT= fltk:Fl_Box(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, "tensplace")<br />
tensplaceT:label(gLabelTable[#gLabelTable])<br />
tensplaceT:resize(465,116,132,89)<br />
tensplaceT:box(fltk.FL_UP_FRAME)<br />
tensplaceT:color(6)<br />
end<br />
<br />
do hundredsplaceT= fltk:Fl_Box(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, "hundredsplaceT")<br />
hundredsplaceT:label(gLabelTable[#gLabelTable])<br />
hundredsplaceT:resize(407,116,190,89)<br />
hundredsplaceT:box(fltk.FL_THIN_UP_FRAME)<br />
hundredsplaceT:color(6)<br />
end<br />
<br />
do onesplaceB= fltk:Fl_Box(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, "onesplace")<br />
onesplaceB:label(gLabelTable[#gLabelTable])<br />
onesplaceB:resize(525,211,72,89)<br />
onesplaceB:box(fltk.FL_UP_FRAME)<br />
onesplaceB:color(6)<br />
end<br />
<br />
do tensplaceB= fltk:Fl_Box(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, "tensplace")<br />
tensplaceB:label(gLabelTable[#gLabelTable])<br />
tensplaceB:resize(465,211,132,89)<br />
tensplaceB:box(fltk.FL_UP_FRAME)<br />
tensplaceB:color(6)<br />
end<br />
<br />
do hundredsplaceB= fltk:Fl_Box(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, "hundredsplaceT")<br />
hundredsplaceB:label(gLabelTable[#gLabelTable])<br />
hundredsplaceB:resize(407,211,190,89)<br />
hundredsplaceB:box(fltk.FL_THIN_UP_FRAME)<br />
hundredsplaceB:color(6)<br />
end<br />
<br />
do hundredsplaceD= fltk:Fl_Box(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, "hundredsplaceT")<br />
hundredsplaceD:label(gLabelTable[#gLabelTable])<br />
hundredsplaceD:resize(193,432,160,81)<br />
hundredsplaceD:box(fltk.FL_THIN_UP_FRAME)<br />
hundredsplaceD:color(6)<br />
end<br />
<br />
do tensplaceD= fltk:Fl_Box(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, "tensplace")<br />
tensplaceD:label(gLabelTable[#gLabelTable])<br />
tensplaceD:resize(243,432,110,81)<br />
tensplaceD:box(fltk.FL_UP_FRAME)<br />
tensplaceD:color(6)<br />
end<br />
<br />
do onesplaceD= fltk:Fl_Box(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, "onesplace")<br />
onesplaceD:label(gLabelTable[#gLabelTable])<br />
onesplaceD:resize(293,432,60,81)<br />
onesplaceD:box(fltk.FL_UP_FRAME)<br />
onesplaceD:color(6)<br />
end<br />
Fl_Group:current(Fl_Group:current():parent())<br />
end<br />
<br />
do MathTab= fltk:Fl_Tabs(0,0,0,0,"")<br />
MathTab:resize(0,4,1515,851)<br />
MathTab:box(fltk.FL_GTK_UP_BOX)<br />
MathTab:color(0)<br />
MathTab:selection_color(34)<br />
do MathGroup= fltk:Fl_Group(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, "Math")<br />
MathGroup:label(gLabelTable[#gLabelTable])<br />
MathGroup:resize(1,33,1481,822)<br />
MathGroup:box(fltk.FL_GTK_UP_BOX)<br />
MathGroup:color(33)<br />
MathGroup:labelsize(11)<br />
MathGroup:labelcolor(59)<br />
MathGroup:when(0)<br />
do divisiongroup= fltk:Fl_Group(0,0,0,0,"")<br />
divisiongroup:resize(186,164,554,666)<br />
divisiongroup:labelcolor(1)<br />
do output1b= fltk:Fl_Output(0,0,0,0,"")<br />
output1b:resize(398,433,208,82)<br />
output1b:box(fltk.FL_NO_BOX)<br />
output1b:labelsize(100)<br />
output1b:labelcolor(80)<br />
output1b:textfont(1)<br />
output1b:textsize(90)<br />
output1b:textcolor(60)<br />
end<br />
<br />
do output2b= fltk:Fl_Output(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, "=")<br />
output2b:label(gLabelTable[#gLabelTable])<br />
output2b:resize(211,433,160,73)<br />
output2b:box(fltk.FL_NO_BOX)<br />
output2b:labelsize(40)<br />
output2b:labelcolor(59)<br />
output2b:textfont(1)<br />
output2b:textsize(90)<br />
output2b:textcolor(60)<br />
end<br />
<br />
do equalsbar1= fltk:Fl_Button(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, "button")<br />
equalsbar1:label(gLabelTable[#gLabelTable])<br />
equalsbar1:resize(365,426,274,5)<br />
equalsbar1:box(fltk.FL_FLAT_BOX)<br />
equalsbar1:color(1)<br />
equalsbar1:selection_color(0)<br />
equalsbar1:labeltype(fltk.FL_NO_LABEL)<br />
end<br />
<br />
do fractionbar= fltk:Fl_Button(0,0,0,0,"")<br />
fractionbar:resize(408,201,216,5)<br />
fractionbar:box(fltk.FL_FLAT_BOX)<br />
fractionbar:color(1)<br />
fractionbar:selection_color(0)<br />
fractionbar:labeltype(fltk.FL_NO_LABEL)<br />
fractionbar:align(4)<br />
end<br />
<br />
do output2c= fltk:Fl_Output(0,0,0,0,"")<br />
output2c:resize(186,802,40,28)<br />
output2c:box(fltk.FL_NO_BOX)<br />
output2c:labelsize(16)<br />
output2c:labelcolor(59)<br />
output2c:textfont(1)<br />
output2c:textsize(16)<br />
output2c:textcolor(181)<br />
end<br />
<br />
do output1c= fltk:Fl_Output(0,0,0,0,"")<br />
output1c:resize(186,777,40,30)<br />
output1c:box(fltk.FL_NO_BOX)<br />
output1c:labelsize(16)<br />
output1c:labelcolor(59)<br />
output1c:textfont(1)<br />
output1c:textsize(16)<br />
output1c:textcolor(181)<br />
end<br />
<br />
do divisionlabel= fltk:Fl_Output(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, ")")<br />
divisionlabel:label(gLabelTable[#gLabelTable])<br />
divisionlabel:resize(398,423,8,82)<br />
divisionlabel:box(fltk.FL_NO_BOX)<br />
divisionlabel:labelsize(100)<br />
divisionlabel:labelcolor(80)<br />
divisionlabel:textfont(1)<br />
divisionlabel:textsize(90)<br />
divisionlabel:textcolor(60)<br />
end<br />
Fl_Group:current(Fl_Group:current():parent())<br />
end<br />
<br />
do answeroutput= fltk:Fl_Output(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, "Answer:")<br />
answeroutput:label(gLabelTable[#gLabelTable])<br />
answeroutput:resize(1,324,561,24)<br />
end<br />
<br />
do output1= fltk:Fl_Output(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, "output1:")<br />
output1:label(gLabelTable[#gLabelTable])<br />
output1:resize(421,112,191,88)<br />
output1:box(fltk.FL_NO_BOX)<br />
output1:labelfont(1)<br />
output1:labelsize(10)<br />
output1:labelcolor(59)<br />
output1:align(5)<br />
output1:textfont(1)<br />
output1:textsize(100)<br />
output1:textcolor(60)<br />
end<br />
<br />
do output2= fltk:Fl_Output(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, "output2:")<br />
output2:label(gLabelTable[#gLabelTable])<br />
output2:resize(421,207,190,88)<br />
output2:box(fltk.FL_NO_BOX)<br />
output2:labelfont(1)<br />
output2:labelsize(10)<br />
output2:labelcolor(59)<br />
output2:align(5)<br />
output2:textfont(1)<br />
output2:textsize(100)<br />
output2:textcolor(60)<br />
end<br />
<br />
do output3= fltk:Fl_Output(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, "output3:")<br />
output3:label(gLabelTable[#gLabelTable])<br />
output3:resize(340,208,81,92)<br />
output3:box(fltk.FL_NO_BOX)<br />
output3:labelsize(10)<br />
output3:labelcolor(59)<br />
output3:textsize(120)<br />
output3:textcolor(61)<br />
end<br />
<br />
do solutionbar= fltk:Fl_Button(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, "button")<br />
solutionbar:label(gLabelTable[#gLabelTable])<br />
solutionbar:resize(361,298,255,7)<br />
solutionbar:box(fltk.FL_FLAT_BOX)<br />
solutionbar:color(218)<br />
solutionbar:selection_color(0)<br />
solutionbar:labeltype(fltk.FL_NO_LABEL)<br />
end<br />
<br />
do AnswerCheck= fltk:Fl_Input(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, "=")<br />
AnswerCheck:label(gLabelTable[#gLabelTable])<br />
AnswerCheck:callback(checkanswer)<br />
AnswerCheck:resize(400,308,215,113)<br />
AnswerCheck:box(fltk.FL_FLAT_BOX)<br />
AnswerCheck:color(35)<br />
AnswerCheck:labelsize(40)<br />
AnswerCheck:labelcolor(59)<br />
AnswerCheck:when(8)<br />
AnswerCheck:textfont(1)<br />
AnswerCheck:textsize(100)<br />
AnswerCheck:textcolor(61)<br />
end<br />
<br />
do StatusGroup= fltk:Fl_Group(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, "Status")<br />
StatusGroup:label(gLabelTable[#gLabelTable])<br />
StatusGroup:resize(10,604,942,113)<br />
StatusGroup:labelsize(11)<br />
do daybar= fltk:Fl_Progress(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, "Daily: 10 Correct")<br />
daybar:label(gLabelTable[#gLabelTable])<br />
daybar:resize(10,667,942,16)<br />
daybar:box(fltk.FL_FLAT_BOX)<br />
daybar:color(32)<br />
daybar:selection_color(34)<br />
daybar:labelsize(10)<br />
daybar:labelcolor(2)<br />
daybar:align(20)<br />
end<br />
<br />
do yearbar= fltk:Fl_Progress(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, "Year:&nbsp;&nbsp;1720 Correct")<br />
yearbar:label(gLabelTable[#gLabelTable])<br />
yearbar:resize(10,684,942,16)<br />
yearbar:box(fltk.FL_FLAT_BOX)<br />
yearbar:color(32)<br />
yearbar:selection_color(34)<br />
yearbar:labelsize(10)<br />
yearbar:labelcolor(2)<br />
yearbar:align(20)<br />
end<br />
<br />
do correctbar= fltk:Fl_Progress(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, "Proficiency")<br />
correctbar:label(gLabelTable[#gLabelTable])<br />
correctbar:resize(10,701,942,16)<br />
correctbar:box(fltk.FL_FLAT_BOX)<br />
correctbar:color(57)<br />
correctbar:selection_color(34)<br />
correctbar:labelsize(10)<br />
correctbar:labelcolor(2)<br />
correctbar:align(20)<br />
end<br />
Fl_Group:current(Fl_Group:current():parent())<br />
end<br />
Fl_Group:current(Fl_Group:current():parent())<br />
end<br />
<br />
do optionsgroup= fltk:Fl_Group(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, "Options")<br />
optionsgroup:label(gLabelTable[#gLabelTable])<br />
optionsgroup:resize(21,30,1440,805)<br />
optionsgroup:box(fltk.FL_GTK_UP_BOX)<br />
optionsgroup:color(32)<br />
optionsgroup:labelsize(10)<br />
<br />
do mincountertop= fltk:Fl_Value_Input(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, "Top number minimum:")<br />
mincountertop:label(gLabelTable[#gLabelTable])<br />
mincountertop:callback(updateMaxMin)<br />
mincountertop:resize(486,246,95,24)<br />
mincountertop:labelfont(1)<br />
mincountertop:labelsize(12)<br />
mincountertop:labelcolor(221)<br />
mincountertop:minimum(1)<br />
mincountertop:maximum(99)<br />
mincountertop:step(1)<br />
mincountertop:value(1)<br />
end<br />
<br />
do maxcounterbottom= fltk:Fl_Value_Input(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, "Bottom number maximum:")<br />
maxcounterbottom:label(gLabelTable[#gLabelTable])<br />
maxcounterbottom:callback(updateMaxMin)<br />
maxcounterbottom:resize(486,333,95,24)<br />
maxcounterbottom:labelfont(1)<br />
maxcounterbottom:labelsize(12)<br />
maxcounterbottom:labelcolor(221)<br />
maxcounterbottom:minimum(1)<br />
maxcounterbottom:maximum(100)<br />
maxcounterbottom:step(1)<br />
maxcounterbottom:value(10)<br />
end<br />
<br />
do mincounterbottom= fltk:Fl_Value_Input(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, "Bottom number minimum:")<br />
mincounterbottom:label(gLabelTable[#gLabelTable])<br />
mincounterbottom:callback(updateMaxMin)<br />
mincounterbottom:resize(486,376,95,24)<br />
mincounterbottom:labelfont(1)<br />
mincounterbottom:labelsize(12)<br />
mincounterbottom:labelcolor(221)<br />
mincounterbottom:minimum(1)<br />
mincounterbottom:maximum(99)<br />
mincounterbottom:step(1)<br />
mincounterbottom:value(1)<br />
end<br />
<br />
do maxcountertop= fltk:Fl_Value_Input(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, "Top number maximum:")<br />
maxcountertop:label(gLabelTable[#gLabelTable])<br />
maxcountertop:callback(updateMaxMin)<br />
maxcountertop:resize(486,286,95,24)<br />
maxcountertop:labelfont(1)<br />
maxcountertop:labelsize(12)<br />
maxcountertop:labelcolor(221)<br />
maxcountertop:minimum(1)<br />
maxcountertop:maximum(100)<br />
maxcountertop:step(1)<br />
maxcountertop:value(10)<br />
end<br />
Fl_Group:current(Fl_Group:current():parent())<br />
end<br />
end<br />
end<br />
MathWindow:show()<br />
<br />
MathWindow:label("MATH MACHINE")<br />
MathWindow:show()<br />
<br />
dailypercent=0<br />
<br />
answeroutput:hide()<br />
maxcounterbottom:value(rndMaxBottom)<br />
maxcountertop:value(rndMaxTop)<br />
<br />
daybar:minimum(0)<br />
daybar:maximum(20) <br />
daybar:value(0)<br />
yearbar:minimum(0)<br />
yearbar:maximum(1720) <br />
correctbar:minimum(0)<br />
correctbar:maximum(101) <br />
<br />
output1:label(" ")<br />
output2:label(" ")<br />
output3:label(" ")<br />
output4:label(" ")<br />
output5:label(" ")<br />
output6:label(" ")<br />
<br />
-- open mathRecord.lua get score["correct"] &amp; score["tries"] data<br />
openMathRecords()<br />
score["correct"]=(#score["addition"])+(#score["subtraction"])+(#score["multiplication"])+(#score["division"])<br />
cycleproblems() <br />
<br />
output5:value(score["tries"])<br />
output4:value(score["correct"])<br />
<br />
Fl:scheme("plastic")<br />
MathWindow:redraw()<br />
MathWindow:make_current()<br />
<br />
Fl:run()<br />
<br />
]]></description>
			<content:encoded><![CDATA[This is a little math quiz program I made for my daughter. She home schools.<br />
With pencil and paper math assignments she'll take 30 minutes for 10 problems, but with this little program she rips through 200 problems in the same time.<br />
<br />
The program only deals with integer math and positive numbers.<br />
The program solves division problems by first multiplying the variables, and providing the answer of the multiplication as a fraction.<br />
It also plays switcheroo with subtraction problems to avoid negative answers.<br />
<br />
The Options tab sets the level of difficulty of the math problems.<br />
<br />
The program writes a record of progress to a file "MathRecords.lua", currently at the root or home directory (depending on how the program is run), you can of course change that in the code.<br />
<br />
I've attached the Fluid file.<br />
<br />
<br />
Code:<br />
rndMinTop=1<br />
rndMinBottom=1<br />
<br />
rndMaxTop=11<br />
rndMaxBottom=11<br />
<br />
rndProcessOption=4<br />
<br />
o1=math.random(rndMinTop,rndMaxTop)<br />
o2=math.random(rndMinBottom,rndMaxBottom)<br />
o3=math.random(1,rndProcessOption)<br />
o4=0<br />
<br />
answervalue=0<br />
<br />
score={{}}<br />
score["answer"]= {}<br />
score["correct"]=""<br />
score["tries"]=""<br />
<br />
score["multiplication"]={}<br />
score["division"]={}<br />
score["subtraction"]={}<br />
score["addition"]={}<br />
<br />
<br />
mathRecords={}<br />
<br />
<br />
local Q = '"';<br />
local ba="{";<br />
local bb="}";<br />
local C=",";<br />
<br />
<br />
score["correct"]=1<br />
score["tries"]=1<br />
score["addition"]={"1,1,1,2"}<br />
score["subtraction"]={"1,1,2,0"}<br />
score["multiplication"]={"1,1,3,1"}<br />
score["division"]={"1,1,4,1"}<br />
currentUnit={}<br />
listCount = 0; --#mathList<br />
totalwords = 0<br />
keystrokeCount = 0<br />
totalLetters =0<br />
wordscompleted=0<br />
spellingTimerStart = os.time()<br />
TotalElapsedTime = 0<br />
UnitElapsedTime = 0<br />
wordsPerMinute = 0<br />
minuteCount = 0<br />
elapsedWordtime = 0<br />
wpmcount = 0<br />
unitDepth = 1<br />
listDepth = 1<br />
wordsPerMinute=0<br />
-- "len": the # operation.<br />
function len_event (op)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if type(op) == "string" then<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return strlen(op)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -- primitive string length<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; elseif type(op) == "table" then<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return #op&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-- primitive table length<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; local h = metatable(op).__len<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if h then<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -- call the handler with the operand<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return (h(op))<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else&nbsp;&nbsp;-- no handler available: default behavior<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; error()<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; end<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; end<br />
&nbsp;&nbsp;&nbsp;&nbsp; end<br />
function getLocations(o1,o2,o3)<br />
<br />
<br />
--TOP<br />
--hundredsplacebox<br />
hptx,hpty = hundredsplaceT:x(),hundredsplaceT:y()<br />
hptw,hpth = hundredsplaceT:w(),hundredsplaceT:h()<br />
--tensplacebox<br />
tptx,tpty = tensplaceT:x(),tensplaceT:y()<br />
tptw,tpth = tensplaceT:w(),tensplaceT:h()<br />
--onesplacebox<br />
optx,opty = onesplaceT:x(),onesplaceT:y()<br />
optw,opth = onesplaceT:w(),onesplaceT:h()<br />
if o1 &lt; 10 then <br />
output1:resize(optx,opty,hptw,hpth)<br />
end<br />
if o1 &gt;= 10 and o1 &lt; 100 then<br />
output1:resize(tptx,tpty ,tptw,tpth)<br />
end<br />
if o1 &gt;= 100 and o1 &lt; 1000 then<br />
output1:resize(hptx,hpty,hptw,hpth)<br />
end<br />
<br />
<br />
<br />
--BOTTOM<br />
--hundredsplacebox<br />
hpbx,hpby = hundredsplaceB:x(),hundredsplaceB:y()<br />
hpbw,hpbh = hundredsplaceB:w(),hundredsplaceB:h()<br />
--tensplacebox<br />
tpbx,tpby = tensplaceB:x(),tensplaceB:y()<br />
tpbw,tpbh = tensplaceB:w(),tensplaceB:h()<br />
--onesplacebox<br />
opbx,opby = onesplaceB:x(),onesplaceB:y()<br />
opbw,opbh = onesplaceB:w(),onesplaceB:h()<br />
o3w,o3h = output3:w(),output3:h()<br />
--DIVISION<br />
--hundredsplacebox<br />
hpdx,hpdy = hundredsplaceD:x(),hundredsplaceD:y()<br />
hpdw,hpdh = hundredsplaceD:w(),hundredsplaceD:h()<br />
--tensplacebox<br />
tpdx,tpdy = tensplaceD:x(),tensplaceD:y()<br />
tpdw,tpdh = tensplaceD:w(),tensplaceD:h()<br />
--onesplacebox<br />
opdx,opdy = onesplaceD:x(),onesplaceD:y()<br />
opdw,opdh = onesplaceD:w(),onesplaceD:h()<br />
<br />
if o2 &lt; 10 then <br />
output2:resize(opbx,opby,hpbw,hpbh)<br />
output3:resize((opbx-o3w),opby,o3w,o3h)<br />
output2b:resize(opdx,opdy,hpbw,hpdh)<br />
end<br />
if o2 &gt;= 10 and o2 &lt; 100 then<br />
output2:resize(tpbx,tpby ,tpbw,tpbh)<br />
output3:resize((tpbx-o3w),opby,o3w,o3h)<br />
output2b:resize(tpdx,tpdy ,tpdw,tpdh)<br />
end<br />
if o2 &gt;= 100 and o2 &lt; 1000 then<br />
output2:resize(hpbx,hpby,hpbw,hpbh)<br />
output3:resize((hpbx-o3w),opby,o3w,o3h)<br />
output2b:resize(hpdx,hpdy,hpbw,hpdh)<br />
end<br />
end<br />
<br />
function listScoreForOutput(TableName)<br />
&nbsp;&nbsp;&nbsp;&nbsp;local Q = '"';<br />
&nbsp;&nbsp;&nbsp;&nbsp;local ba="{";<br />
&nbsp;&nbsp;&nbsp;&nbsp;local bb="}";<br />
&nbsp;&nbsp;&nbsp;&nbsp;local C=",";<br />
<br />
local listout = ""<br />
local scoreword={}<br />
local wordlist=""<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for i = 1,#score[TableName],1 do<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;scoreword=score[TableName][i]&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;qfind = string.find(scoreword,Q)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if qfind == nil then<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;scoreword=Q..scoreword..Q<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;listout = listout..scoreword..C<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; scoreout="&#92;n".."score["..Q..TableName..Q.."]="..ba..string.sub(listout,1,-2)..bb;<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;return scoreout&nbsp;&nbsp;&nbsp;&nbsp;<br />
end<br />
function updateMaxMin()<br />
rndMinTop=mincountertop:value()<br />
rndMinBottom=mincounterbottom:value()<br />
rndMaxTop=maxcountertop:value()<br />
rndMaxBottom=maxcounterbottom:value()<br />
return rndMinTop,rndMinBottom,rndMaxTop,rndMaxBottom<br />
end<br />
function updateProcessOptions()<br />
<br />
end<br />
function updateProgressValues()<br />
currentcorrect = score["correct"] <br />
currenttries = score["tries"]<br />
<br />
daybar:value(dailypercent)<br />
daybar:label(dailypercent.." today")<br />
<br />
dailypercentupvalue=( currentcorrect / currenttries )*100<br />
correctbar:value(dailypercentupvalue)<br />
correctbar:label("Proficiency: "..dailypercentupvalue)<br />
<br />
monthlypercent=(currentcorrect)/200<br />
yearlypercent=(currentcorrect)/1720<br />
currentpercent=((currentcorrect)/10)*100<br />
<br />
--output4:value(currentcorrect)<br />
--output5:value(currenttries)<br />
<br />
<br />
yearbar:value((1720-currentcorrect))<br />
yearbar:label(currentcorrect.." of 1720")<br />
<br />
sc=score["correct"]<br />
st=score["tries"]<br />
MathWindow:label(sc.." correct of "..st.." tries".." | Proficiency:"..dailypercentupvalue.." | 1720")<br />
<br />
end<br />
function openMathRecords()<br />
listFile="mathRecord.lua"<br />
&nbsp;&nbsp;&nbsp;&nbsp;local sl=io.open(listFile,"r*")<br />
&nbsp;&nbsp;&nbsp;&nbsp;if sl~=nil then<br />
&nbsp;&nbsp;&nbsp;&nbsp;dofile(listFile)<br />
&nbsp;&nbsp;&nbsp;&nbsp;sl:close()<br />
&nbsp;&nbsp;&nbsp;&nbsp;end<br />
&nbsp;&nbsp;&nbsp;&nbsp;return score["correct"]&nbsp;&nbsp;&nbsp;&nbsp;<br />
end<br />
function openCurrentMathProgress()<br />
wordlistdepthfile = "CurrentMathProgress.txt"<br />
myFile = io.open(wordlistdepthfile,"r")<br />
if myFile ~= nil then<br />
 dofile(wordlistdepthfile)<br />
 myFile:close()<br />
end<br />
end<br />
function WriteMathListsToFile()<br />
mathListsFile = "mathRecord.lua"<br />
&nbsp;&nbsp;&nbsp;&nbsp;local f = io.open(mathListsFile,"w")<br />
&nbsp;&nbsp;&nbsp;&nbsp;local Q = '"';<br />
&nbsp;&nbsp;&nbsp;&nbsp;local ba="{";<br />
&nbsp;&nbsp;&nbsp;&nbsp;local bb="}";<br />
&nbsp;&nbsp;&nbsp;&nbsp;local C=",";<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;if f ~= nil then <br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;correct=score["correct"]<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tries=score["tries"]<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;listwrite="&#92;n"<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;listwrite = listwrite.."&#92;n"..listScoreForOutput("addition")<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;listwrite = listwrite.."&#92;n"..listScoreForOutput("subtraction")<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;listwrite = listwrite.."&#92;n"..listScoreForOutput("multiplication")<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;listwrite = listwrite.."&#92;n"..listScoreForOutput("division")<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;listwrite = listwrite.."&#92;n".."score["..Q.."correct"..Q.."]="..correct..";&#92;n";<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;listwrite = listwrite.."&#92;n".."score["..Q.."tries"..Q.."]="..tries..";&#92;n";<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;f:write(listwrite)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;f:write(string.char (10))<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;io.close(f)<br />
&nbsp;&nbsp;&nbsp;&nbsp;end<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
end<br />
function progressdaily()<br />
progbar:minimum(0)<br />
progbar:maximum(100) <br />
end<br />
function randomize()<br />
o1=math.random(rndMinTop,rndMaxTop)<br />
o2=math.random(rndMinBottom,rndMaxBottom)<br />
<br />
<br />
o3=math.random(1,rndProcessOption)<br />
<br />
<br />
o4=0<br />
return o1,o2,o3<br />
end<br />
function answerproblem(o1,o2,o3,answervalue)<br />
<br />
<br />
mathsigns={"+","-","/","*","^"}<br />
<br />
-- addition<br />
if o3 == 1 then answervalue = o1 + o2 end<br />
<br />
-- multiplication<br />
if o3 == 4 then answervalue = o1 * o2 end<br />
<br />
-- handle subtraction without negative values<br />
if o3 == 2 then <br />
&nbsp;&nbsp;&nbsp;&nbsp;if o1 &lt; o2 then <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;hold1 = o1<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ol = o2<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;o2 = hold1<br />
&nbsp;&nbsp;&nbsp;&nbsp;end<br />
&nbsp;&nbsp;&nbsp;&nbsp;answervalue = o1 - o2 <br />
end<br />
<br />
-- handle fractions as divisions<br />
&nbsp;&nbsp;&nbsp;&nbsp;if o3 == 3 then&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;subtotal = o1 * o2 <br />
&nbsp;&nbsp;&nbsp;&nbsp;answervalue = o1<br />
&nbsp;&nbsp;&nbsp;&nbsp;o1=subtotal<br />
&nbsp;&nbsp;&nbsp;&nbsp;fractionbar:show()<br />
&nbsp;&nbsp;&nbsp;&nbsp;divisiongroup:show()<br />
&nbsp;&nbsp;&nbsp;&nbsp;output3:label("Divide")<br />
&nbsp;&nbsp;&nbsp;&nbsp;output2b:value(o2)<br />
&nbsp;&nbsp;&nbsp;&nbsp;output1b:value(o1)<br />
&nbsp;&nbsp;&nbsp;&nbsp;output2c:value(o2)<br />
&nbsp;&nbsp;&nbsp;&nbsp;output1c:value(o1)<br />
&nbsp;&nbsp;&nbsp;&nbsp;else<br />
&nbsp;&nbsp;&nbsp;&nbsp;divisiongroup:hide()<br />
&nbsp;&nbsp;&nbsp;&nbsp;output3:label(" ")<br />
&nbsp;&nbsp;&nbsp;&nbsp;fractionbar:hide()<br />
&nbsp;&nbsp;&nbsp;&nbsp;end<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
output1:value(o1)<br />
output2:value(o2)<br />
output3:value(mathsigns[o3])<br />
<br />
<br />
<br />
getLocations(o1,o2,o3)<br />
<br />
answeroutput:value(answervalue)<br />
alloutputs = o1..","..o2..","..o3..","..answervalue<br />
<br />
return o1,o2,o3,answervalue<br />
end<br />
function checkanswer(w)<br />
local tried=score["tries"]<br />
<br />
if AnswerCheck:value() ~= nil then <br />
alloutputs = Q..o1..output3:value()..o2.."="..answeroutput:value()..Q<br />
tried=tried+1<br />
score["tries"]=tried<br />
<br />
end<br />
<br />
alloutputs = Q..o1..","..o2..","..o3..","..answeroutput:value()..Q<br />
<br />
--if the entered value equals correct answer<br />
if w:value() == answeroutput:value() then<br />
dailypercent=dailypercent +1<br />
score["correct"]=score["correct"]+1&nbsp;&nbsp;&nbsp;&nbsp;<br />
<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;if o3 == 1 then <br />
&nbsp;&nbsp;&nbsp;&nbsp;alloutputs = Q..o1..","..o2..","..answeroutput:value()..Q<br />
&nbsp;&nbsp;&nbsp;&nbsp;table.insert(score["addition"], alloutputs)<br />
&nbsp;&nbsp;&nbsp;&nbsp;end<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;if o3 == 2 then <br />
&nbsp;&nbsp;&nbsp;&nbsp;alloutputs = Q..o1..","..o2..","..answeroutput:value()..Q<br />
&nbsp;&nbsp;&nbsp;&nbsp;table.insert(score["subtraction"], alloutputs)<br />
&nbsp;&nbsp;&nbsp;&nbsp;end<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;if o3 == 3 then <br />
&nbsp;&nbsp;&nbsp;&nbsp;alloutputs = Q..o1..","..o2..","..answeroutput:value()..Q<br />
&nbsp;&nbsp;&nbsp;&nbsp;table.insert(score["multiplication"], alloutputs)<br />
&nbsp;&nbsp;&nbsp;&nbsp;end<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;if o3 == 4 then <br />
&nbsp;&nbsp;&nbsp;&nbsp;alloutputs = Q..o1..","..o2..","..answeroutput:value()..Q<br />
&nbsp;&nbsp;&nbsp;&nbsp;table.insert(score["division"], alloutputs)<br />
&nbsp;&nbsp;&nbsp;&nbsp;end<br />
<br />
<br />
<br />
rndMinTop,rndMinBottom,rndMaxTop,rndMaxBottom=updateMaxMin()<br />
o1,o2,o3,answervalue = answerproblem(randomize(rndMinTop,rndMaxBottom,4))<br />
w:value("")<br />
save()<br />
end<br />
<br />
updateProgressValues()<br />
<br />
<br />
MathWindow:redraw()<br />
MathWindow:make_current()<br />
end<br />
function cycleproblems()<br />
<br />
<br />
o1,o2,o3,answervalue = answerproblem(randomize(rndMaxTop,rndMaxBottom,rndProcessOption))<br />
<br />
<br />
MathWindow:redraw()<br />
MathWindow:make_current()<br />
end<br />
function save()<br />
WriteMathListsToFile()<br />
end<br />
if MathWindow ~= nil then MathWindow:hide() end<br />
do MathWindow= fltk:Fl_Double_Window(0,0,0,0,"")<br />
MathWindow:resize(63,50,965,721)<br />
MathWindow:color(0)<br />
--MathWindow:show()<br />
do HiddenGroup= fltk:Fl_Group(0,0,0,0,"")<br />
HiddenGroup:resize(15,5,1410,630)<br />
--unknown attribute: hide<br />
--unknown attribute: deactivate<br />
do output6= fltk:Fl_Output(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, "=")<br />
output6:label(gLabelTable[#gLabelTable])<br />
output6:resize(1105,14,150,17)<br />
output6:color(31)<br />
output6:labelsize(12)<br />
output6:labelcolor(7)<br />
output6:align(36)<br />
output6:textcolor(7)<br />
end<br />
<br />
do NextButton= fltk:Fl_Button(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, "NEXT")<br />
NextButton:label(gLabelTable[#gLabelTable])<br />
NextButton:callback(cycleproblems)<br />
NextButton:resize(1270,15,60,15)<br />
NextButton:labelsize(12)<br />
end<br />
<br />
do Save= fltk:Fl_Button(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, "Save")<br />
Save:label(gLabelTable[#gLabelTable])<br />
Save:callback(save)<br />
Save:resize(1335,15,60,15)<br />
--unknown attribute: deactivate<br />
end<br />
<br />
do output4= fltk:Fl_Output(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, "Correct of:")<br />
output4:label(gLabelTable[#gLabelTable])<br />
output4:resize(15,616,25,19)<br />
output4:box(fltk.FL_NO_BOX)<br />
output4:color(31)<br />
output4:labelsize(10)<br />
output4:labelcolor(62)<br />
output4:align(40)<br />
output4:textsize(10)<br />
output4:textcolor(62)<br />
end<br />
<br />
do output5= fltk:Fl_Output(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, "Tries")<br />
output5:label(gLabelTable[#gLabelTable])<br />
output5:resize(90,616,25,19)<br />
output5:box(fltk.FL_NO_BOX)<br />
output5:color(31)<br />
output5:labelsize(10)<br />
output5:labelcolor(62)<br />
output5:align(40)<br />
output5:textsize(10)<br />
output5:textcolor(62)<br />
end<br />
Fl_Group:current(Fl_Group:current():parent())<br />
end<br />
<br />
do NumPositionGroup= fltk:Fl_Group(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, "NumPositionGroup")<br />
NumPositionGroup:label(gLabelTable[#gLabelTable])<br />
NumPositionGroup:resize(173,108,459,424)<br />
<br />
do onesplaceT= fltk:Fl_Box(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, "onesplace")<br />
onesplaceT:label(gLabelTable[#gLabelTable])<br />
onesplaceT:resize(525,116,72,89)<br />
onesplaceT:box(fltk.FL_UP_FRAME)<br />
onesplaceT:color(6)<br />
end<br />
<br />
do tensplaceT= fltk:Fl_Box(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, "tensplace")<br />
tensplaceT:label(gLabelTable[#gLabelTable])<br />
tensplaceT:resize(465,116,132,89)<br />
tensplaceT:box(fltk.FL_UP_FRAME)<br />
tensplaceT:color(6)<br />
end<br />
<br />
do hundredsplaceT= fltk:Fl_Box(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, "hundredsplaceT")<br />
hundredsplaceT:label(gLabelTable[#gLabelTable])<br />
hundredsplaceT:resize(407,116,190,89)<br />
hundredsplaceT:box(fltk.FL_THIN_UP_FRAME)<br />
hundredsplaceT:color(6)<br />
end<br />
<br />
do onesplaceB= fltk:Fl_Box(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, "onesplace")<br />
onesplaceB:label(gLabelTable[#gLabelTable])<br />
onesplaceB:resize(525,211,72,89)<br />
onesplaceB:box(fltk.FL_UP_FRAME)<br />
onesplaceB:color(6)<br />
end<br />
<br />
do tensplaceB= fltk:Fl_Box(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, "tensplace")<br />
tensplaceB:label(gLabelTable[#gLabelTable])<br />
tensplaceB:resize(465,211,132,89)<br />
tensplaceB:box(fltk.FL_UP_FRAME)<br />
tensplaceB:color(6)<br />
end<br />
<br />
do hundredsplaceB= fltk:Fl_Box(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, "hundredsplaceT")<br />
hundredsplaceB:label(gLabelTable[#gLabelTable])<br />
hundredsplaceB:resize(407,211,190,89)<br />
hundredsplaceB:box(fltk.FL_THIN_UP_FRAME)<br />
hundredsplaceB:color(6)<br />
end<br />
<br />
do hundredsplaceD= fltk:Fl_Box(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, "hundredsplaceT")<br />
hundredsplaceD:label(gLabelTable[#gLabelTable])<br />
hundredsplaceD:resize(193,432,160,81)<br />
hundredsplaceD:box(fltk.FL_THIN_UP_FRAME)<br />
hundredsplaceD:color(6)<br />
end<br />
<br />
do tensplaceD= fltk:Fl_Box(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, "tensplace")<br />
tensplaceD:label(gLabelTable[#gLabelTable])<br />
tensplaceD:resize(243,432,110,81)<br />
tensplaceD:box(fltk.FL_UP_FRAME)<br />
tensplaceD:color(6)<br />
end<br />
<br />
do onesplaceD= fltk:Fl_Box(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, "onesplace")<br />
onesplaceD:label(gLabelTable[#gLabelTable])<br />
onesplaceD:resize(293,432,60,81)<br />
onesplaceD:box(fltk.FL_UP_FRAME)<br />
onesplaceD:color(6)<br />
end<br />
Fl_Group:current(Fl_Group:current():parent())<br />
end<br />
<br />
do MathTab= fltk:Fl_Tabs(0,0,0,0,"")<br />
MathTab:resize(0,4,1515,851)<br />
MathTab:box(fltk.FL_GTK_UP_BOX)<br />
MathTab:color(0)<br />
MathTab:selection_color(34)<br />
do MathGroup= fltk:Fl_Group(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, "Math")<br />
MathGroup:label(gLabelTable[#gLabelTable])<br />
MathGroup:resize(1,33,1481,822)<br />
MathGroup:box(fltk.FL_GTK_UP_BOX)<br />
MathGroup:color(33)<br />
MathGroup:labelsize(11)<br />
MathGroup:labelcolor(59)<br />
MathGroup:when(0)<br />
do divisiongroup= fltk:Fl_Group(0,0,0,0,"")<br />
divisiongroup:resize(186,164,554,666)<br />
divisiongroup:labelcolor(1)<br />
do output1b= fltk:Fl_Output(0,0,0,0,"")<br />
output1b:resize(398,433,208,82)<br />
output1b:box(fltk.FL_NO_BOX)<br />
output1b:labelsize(100)<br />
output1b:labelcolor(80)<br />
output1b:textfont(1)<br />
output1b:textsize(90)<br />
output1b:textcolor(60)<br />
end<br />
<br />
do output2b= fltk:Fl_Output(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, "=")<br />
output2b:label(gLabelTable[#gLabelTable])<br />
output2b:resize(211,433,160,73)<br />
output2b:box(fltk.FL_NO_BOX)<br />
output2b:labelsize(40)<br />
output2b:labelcolor(59)<br />
output2b:textfont(1)<br />
output2b:textsize(90)<br />
output2b:textcolor(60)<br />
end<br />
<br />
do equalsbar1= fltk:Fl_Button(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, "button")<br />
equalsbar1:label(gLabelTable[#gLabelTable])<br />
equalsbar1:resize(365,426,274,5)<br />
equalsbar1:box(fltk.FL_FLAT_BOX)<br />
equalsbar1:color(1)<br />
equalsbar1:selection_color(0)<br />
equalsbar1:labeltype(fltk.FL_NO_LABEL)<br />
end<br />
<br />
do fractionbar= fltk:Fl_Button(0,0,0,0,"")<br />
fractionbar:resize(408,201,216,5)<br />
fractionbar:box(fltk.FL_FLAT_BOX)<br />
fractionbar:color(1)<br />
fractionbar:selection_color(0)<br />
fractionbar:labeltype(fltk.FL_NO_LABEL)<br />
fractionbar:align(4)<br />
end<br />
<br />
do output2c= fltk:Fl_Output(0,0,0,0,"")<br />
output2c:resize(186,802,40,28)<br />
output2c:box(fltk.FL_NO_BOX)<br />
output2c:labelsize(16)<br />
output2c:labelcolor(59)<br />
output2c:textfont(1)<br />
output2c:textsize(16)<br />
output2c:textcolor(181)<br />
end<br />
<br />
do output1c= fltk:Fl_Output(0,0,0,0,"")<br />
output1c:resize(186,777,40,30)<br />
output1c:box(fltk.FL_NO_BOX)<br />
output1c:labelsize(16)<br />
output1c:labelcolor(59)<br />
output1c:textfont(1)<br />
output1c:textsize(16)<br />
output1c:textcolor(181)<br />
end<br />
<br />
do divisionlabel= fltk:Fl_Output(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, ")")<br />
divisionlabel:label(gLabelTable[#gLabelTable])<br />
divisionlabel:resize(398,423,8,82)<br />
divisionlabel:box(fltk.FL_NO_BOX)<br />
divisionlabel:labelsize(100)<br />
divisionlabel:labelcolor(80)<br />
divisionlabel:textfont(1)<br />
divisionlabel:textsize(90)<br />
divisionlabel:textcolor(60)<br />
end<br />
Fl_Group:current(Fl_Group:current():parent())<br />
end<br />
<br />
do answeroutput= fltk:Fl_Output(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, "Answer:")<br />
answeroutput:label(gLabelTable[#gLabelTable])<br />
answeroutput:resize(1,324,561,24)<br />
end<br />
<br />
do output1= fltk:Fl_Output(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, "output1:")<br />
output1:label(gLabelTable[#gLabelTable])<br />
output1:resize(421,112,191,88)<br />
output1:box(fltk.FL_NO_BOX)<br />
output1:labelfont(1)<br />
output1:labelsize(10)<br />
output1:labelcolor(59)<br />
output1:align(5)<br />
output1:textfont(1)<br />
output1:textsize(100)<br />
output1:textcolor(60)<br />
end<br />
<br />
do output2= fltk:Fl_Output(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, "output2:")<br />
output2:label(gLabelTable[#gLabelTable])<br />
output2:resize(421,207,190,88)<br />
output2:box(fltk.FL_NO_BOX)<br />
output2:labelfont(1)<br />
output2:labelsize(10)<br />
output2:labelcolor(59)<br />
output2:align(5)<br />
output2:textfont(1)<br />
output2:textsize(100)<br />
output2:textcolor(60)<br />
end<br />
<br />
do output3= fltk:Fl_Output(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, "output3:")<br />
output3:label(gLabelTable[#gLabelTable])<br />
output3:resize(340,208,81,92)<br />
output3:box(fltk.FL_NO_BOX)<br />
output3:labelsize(10)<br />
output3:labelcolor(59)<br />
output3:textsize(120)<br />
output3:textcolor(61)<br />
end<br />
<br />
do solutionbar= fltk:Fl_Button(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, "button")<br />
solutionbar:label(gLabelTable[#gLabelTable])<br />
solutionbar:resize(361,298,255,7)<br />
solutionbar:box(fltk.FL_FLAT_BOX)<br />
solutionbar:color(218)<br />
solutionbar:selection_color(0)<br />
solutionbar:labeltype(fltk.FL_NO_LABEL)<br />
end<br />
<br />
do AnswerCheck= fltk:Fl_Input(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, "=")<br />
AnswerCheck:label(gLabelTable[#gLabelTable])<br />
AnswerCheck:callback(checkanswer)<br />
AnswerCheck:resize(400,308,215,113)<br />
AnswerCheck:box(fltk.FL_FLAT_BOX)<br />
AnswerCheck:color(35)<br />
AnswerCheck:labelsize(40)<br />
AnswerCheck:labelcolor(59)<br />
AnswerCheck:when(8)<br />
AnswerCheck:textfont(1)<br />
AnswerCheck:textsize(100)<br />
AnswerCheck:textcolor(61)<br />
end<br />
<br />
do StatusGroup= fltk:Fl_Group(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, "Status")<br />
StatusGroup:label(gLabelTable[#gLabelTable])<br />
StatusGroup:resize(10,604,942,113)<br />
StatusGroup:labelsize(11)<br />
do daybar= fltk:Fl_Progress(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, "Daily: 10 Correct")<br />
daybar:label(gLabelTable[#gLabelTable])<br />
daybar:resize(10,667,942,16)<br />
daybar:box(fltk.FL_FLAT_BOX)<br />
daybar:color(32)<br />
daybar:selection_color(34)<br />
daybar:labelsize(10)<br />
daybar:labelcolor(2)<br />
daybar:align(20)<br />
end<br />
<br />
do yearbar= fltk:Fl_Progress(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, "Year:&nbsp;&nbsp;1720 Correct")<br />
yearbar:label(gLabelTable[#gLabelTable])<br />
yearbar:resize(10,684,942,16)<br />
yearbar:box(fltk.FL_FLAT_BOX)<br />
yearbar:color(32)<br />
yearbar:selection_color(34)<br />
yearbar:labelsize(10)<br />
yearbar:labelcolor(2)<br />
yearbar:align(20)<br />
end<br />
<br />
do correctbar= fltk:Fl_Progress(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, "Proficiency")<br />
correctbar:label(gLabelTable[#gLabelTable])<br />
correctbar:resize(10,701,942,16)<br />
correctbar:box(fltk.FL_FLAT_BOX)<br />
correctbar:color(57)<br />
correctbar:selection_color(34)<br />
correctbar:labelsize(10)<br />
correctbar:labelcolor(2)<br />
correctbar:align(20)<br />
end<br />
Fl_Group:current(Fl_Group:current():parent())<br />
end<br />
Fl_Group:current(Fl_Group:current():parent())<br />
end<br />
<br />
do optionsgroup= fltk:Fl_Group(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, "Options")<br />
optionsgroup:label(gLabelTable[#gLabelTable])<br />
optionsgroup:resize(21,30,1440,805)<br />
optionsgroup:box(fltk.FL_GTK_UP_BOX)<br />
optionsgroup:color(32)<br />
optionsgroup:labelsize(10)<br />
<br />
do mincountertop= fltk:Fl_Value_Input(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, "Top number minimum:")<br />
mincountertop:label(gLabelTable[#gLabelTable])<br />
mincountertop:callback(updateMaxMin)<br />
mincountertop:resize(486,246,95,24)<br />
mincountertop:labelfont(1)<br />
mincountertop:labelsize(12)<br />
mincountertop:labelcolor(221)<br />
mincountertop:minimum(1)<br />
mincountertop:maximum(99)<br />
mincountertop:step(1)<br />
mincountertop:value(1)<br />
end<br />
<br />
do maxcounterbottom= fltk:Fl_Value_Input(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, "Bottom number maximum:")<br />
maxcounterbottom:label(gLabelTable[#gLabelTable])<br />
maxcounterbottom:callback(updateMaxMin)<br />
maxcounterbottom:resize(486,333,95,24)<br />
maxcounterbottom:labelfont(1)<br />
maxcounterbottom:labelsize(12)<br />
maxcounterbottom:labelcolor(221)<br />
maxcounterbottom:minimum(1)<br />
maxcounterbottom:maximum(100)<br />
maxcounterbottom:step(1)<br />
maxcounterbottom:value(10)<br />
end<br />
<br />
do mincounterbottom= fltk:Fl_Value_Input(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, "Bottom number minimum:")<br />
mincounterbottom:label(gLabelTable[#gLabelTable])<br />
mincounterbottom:callback(updateMaxMin)<br />
mincounterbottom:resize(486,376,95,24)<br />
mincounterbottom:labelfont(1)<br />
mincounterbottom:labelsize(12)<br />
mincounterbottom:labelcolor(221)<br />
mincounterbottom:minimum(1)<br />
mincounterbottom:maximum(99)<br />
mincounterbottom:step(1)<br />
mincounterbottom:value(1)<br />
end<br />
<br />
do maxcountertop= fltk:Fl_Value_Input(0,0,0,0,"")<br />
if gLabelTable==nil then gLabelTable={} end<br />
table.insert(gLabelTable, "Top number maximum:")<br />
maxcountertop:label(gLabelTable[#gLabelTable])<br />
maxcountertop:callback(updateMaxMin)<br />
maxcountertop:resize(486,286,95,24)<br />
maxcountertop:labelfont(1)<br />
maxcountertop:labelsize(12)<br />
maxcountertop:labelcolor(221)<br />
maxcountertop:minimum(1)<br />
maxcountertop:maximum(100)<br />
maxcountertop:step(1)<br />
maxcountertop:value(10)<br />
end<br />
Fl_Group:current(Fl_Group:current():parent())<br />
end<br />
end<br />
end<br />
MathWindow:show()<br />
<br />
MathWindow:label("MATH MACHINE")<br />
MathWindow:show()<br />
<br />
dailypercent=0<br />
<br />
answeroutput:hide()<br />
maxcounterbottom:value(rndMaxBottom)<br />
maxcountertop:value(rndMaxTop)<br />
<br />
daybar:minimum(0)<br />
daybar:maximum(20) <br />
daybar:value(0)<br />
yearbar:minimum(0)<br />
yearbar:maximum(1720) <br />
correctbar:minimum(0)<br />
correctbar:maximum(101) <br />
<br />
output1:label(" ")<br />
output2:label(" ")<br />
output3:label(" ")<br />
output4:label(" ")<br />
output5:label(" ")<br />
output6:label(" ")<br />
<br />
-- open mathRecord.lua get score["correct"] &amp; score["tries"] data<br />
openMathRecords()<br />
score["correct"]=(#score["addition"])+(#score["subtraction"])+(#score["multiplication"])+(#score["division"])<br />
cycleproblems() <br />
<br />
output5:value(score["tries"])<br />
output4:value(score["correct"])<br />
<br />
Fl:scheme("plastic")<br />
MathWindow:redraw()<br />
MathWindow:make_current()<br />
<br />
Fl:run()<br />
<br />
]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Temperature comparison]]></title>
			<link>http://www.murga-projects.com/forum/showthread.php?tid=377</link>
			<pubDate>Sat, 17 Apr 2010 06:48:05 -0600</pubDate>
			<guid isPermaLink="false">http://www.murga-projects.com/forum/showthread.php?tid=377</guid>
			<description><![CDATA[Here's a simple tool to compare temperatures in celcius, fahrenheit, and kelvin, and show some temperature levels of note.<br />
<br />
It isn't finished, or even entirely accurate.  The conversions are rounded to integers, which I might change in the future, and a lot more "notable temps" need to be included.  Also going to eliminate some redundancy in the code.<br />
<br />
Posting for criticism/suggestions.<br />
<br />
Code:<br />
#!/usr/bin/env murgaLua<br />
<br />
function chk()<br />
box:label("")<br />
for k,v in pairs(temps) do<br />
if math.floor(sk:value())==k then box:label(v) end<br />
end<br />
end<br />
<br />
temps={<br />
[0]="absolute zero",<br />
[159]="freezing point of pure ethanol",<br />
[184]="coldest air temperature recorded on Earth (Vostok, Antarctica, 1983)",<br />
[273]="freezing point of water",<br />
[309]="average human body temperature",<br />
[331]="Highest air temperature recorded on Earth (El Azizia, Libya, 1922)";<br />
[351]="boiling point of ethanol",<br />
[373]="boiling point of water",<br />
[516]="Ignition temperature of sulfur",<br />
[553]="Ignition temperature of gasoline",<br />
[622]="Ignition temperature of charcoal",<br />
[672]="Ignition temperature of isopropyl alcohol",<br />
[673]="Ignition temperature of petroleum",<br />
[693]="Ignition temperature of butane",<br />
[753]="Ignition temperature of propane",<br />
[773]="Ignition temperature of hydrogen",<br />
[973]="Ignition temperature of carbon",<br />
[1670]="The hottest (blue) part of a candle flame";<br />
[5800]="estimated temperature of the sun's surface"<br />
}<br />
<br />
ww=600; sh=30<br />
w=fltk:Fl_Double_Window(ww,sh*5,"Temperature Conversion")<br />
<br />
sf=fltk:Fl_Hor_Value_Slider(20,10,ww-30,sh,"F")<br />
sf:align(4); --sf:when(fltk.FL_WHEN_RELEASE)<br />
sf:minimum(-459); sf:maximum(212); sf:value(32); sf:step(1)<br />
sf:callback(function()<br />
sc:value((sf:value() - 32) * 5/9)<br />
sk:value(sc:value()+273)<br />
chk()<br />
end)<br />
<br />
sc=fltk:Fl_Hor_Value_Slider(20,10+sh,ww-30,sh,"C")<br />
sc:align(4); --sc:when(fltk.FL_WHEN_RELEASE)<br />
sc:minimum(-273); sc:maximum(420); sc:step(1)<br />
sc:callback(function()<br />
sf:value(sc:value() * 9/5 + 32)<br />
sk:value(sc:value() + 273)<br />
chk()<br />
end)<br />
<br />
sk=fltk:Fl_Hor_Value_Slider(20,10+sh*2,ww-30,sh,"K")<br />
sk:align(4); --sk:when(fltk.FL_WHEN_RELEASE)<br />
sk:minimum(0); sk:maximum(5800); sk:value(273); sk:step(1)<br />
sk:callback(function()<br />
sf:value((sk:value() - 273) * 9/5 + 32 )<br />
sc:value(sk:value() - 273)<br />
chk()<br />
end)<br />
<br />
box=fltk:Fl_Box(20,10+sh*3,ww-30,sh)<br />
box:box(fltk.FL_DOWN_BOX)<br />
sc:do_callback()<br />
<br />
w:show()<br />
Fl:run()<br />
<br />
]]></description>
			<content:encoded><![CDATA[Here's a simple tool to compare temperatures in celcius, fahrenheit, and kelvin, and show some temperature levels of note.<br />
<br />
It isn't finished, or even entirely accurate.  The conversions are rounded to integers, which I might change in the future, and a lot more "notable temps" need to be included.  Also going to eliminate some redundancy in the code.<br />
<br />
Posting for criticism/suggestions.<br />
<br />
Code:<br />
#!/usr/bin/env murgaLua<br />
<br />
function chk()<br />
box:label("")<br />
for k,v in pairs(temps) do<br />
if math.floor(sk:value())==k then box:label(v) end<br />
end<br />
end<br />
<br />
temps={<br />
[0]="absolute zero",<br />
[159]="freezing point of pure ethanol",<br />
[184]="coldest air temperature recorded on Earth (Vostok, Antarctica, 1983)",<br />
[273]="freezing point of water",<br />
[309]="average human body temperature",<br />
[331]="Highest air temperature recorded on Earth (El Azizia, Libya, 1922)";<br />
[351]="boiling point of ethanol",<br />
[373]="boiling point of water",<br />
[516]="Ignition temperature of sulfur",<br />
[553]="Ignition temperature of gasoline",<br />
[622]="Ignition temperature of charcoal",<br />
[672]="Ignition temperature of isopropyl alcohol",<br />
[673]="Ignition temperature of petroleum",<br />
[693]="Ignition temperature of butane",<br />
[753]="Ignition temperature of propane",<br />
[773]="Ignition temperature of hydrogen",<br />
[973]="Ignition temperature of carbon",<br />
[1670]="The hottest (blue) part of a candle flame";<br />
[5800]="estimated temperature of the sun's surface"<br />
}<br />
<br />
ww=600; sh=30<br />
w=fltk:Fl_Double_Window(ww,sh*5,"Temperature Conversion")<br />
<br />
sf=fltk:Fl_Hor_Value_Slider(20,10,ww-30,sh,"F")<br />
sf:align(4); --sf:when(fltk.FL_WHEN_RELEASE)<br />
sf:minimum(-459); sf:maximum(212); sf:value(32); sf:step(1)<br />
sf:callback(function()<br />
sc:value((sf:value() - 32) * 5/9)<br />
sk:value(sc:value()+273)<br />
chk()<br />
end)<br />
<br />
sc=fltk:Fl_Hor_Value_Slider(20,10+sh,ww-30,sh,"C")<br />
sc:align(4); --sc:when(fltk.FL_WHEN_RELEASE)<br />
sc:minimum(-273); sc:maximum(420); sc:step(1)<br />
sc:callback(function()<br />
sf:value(sc:value() * 9/5 + 32)<br />
sk:value(sc:value() + 273)<br />
chk()<br />
end)<br />
<br />
sk=fltk:Fl_Hor_Value_Slider(20,10+sh*2,ww-30,sh,"K")<br />
sk:align(4); --sk:when(fltk.FL_WHEN_RELEASE)<br />
sk:minimum(0); sk:maximum(5800); sk:value(273); sk:step(1)<br />
sk:callback(function()<br />
sf:value((sk:value() - 273) * 9/5 + 32 )<br />
sc:value(sk:value() - 273)<br />
chk()<br />
end)<br />
<br />
box=fltk:Fl_Box(20,10+sh*3,ww-30,sh)<br />
box:box(fltk.FL_DOWN_BOX)<br />
sc:do_callback()<br />
<br />
w:show()<br />
Fl:run()<br />
<br />
]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Steganography]]></title>
			<link>http://www.murga-projects.com/forum/showthread.php?tid=376</link>
			<pubDate>Fri, 09 Apr 2010 15:26:57 -0600</pubDate>
			<guid isPermaLink="false">http://www.murga-projects.com/forum/showthread.php?tid=376</guid>
			<description><![CDATA[While watching Along Came a Spider last night on the telly, I noticed the school kids were playing with a "stego" program to embed and encrypt secret messages into image files.  I'd done embedded zip files before, but thought this was a more interesting and secure alternative.  After a bit of Google I found the commandline cross-platform program Steghide.  So now here's a limited GUI for it.<br />
<br />
The limitations are:<br />
1) Embedding only (extraction will probably be added later)<br />
2) JPEG container only (personal preference, unlikely to change)<br />
3) No support for most options (will be improved later)<br />
4) No way to change the image after it's loaded (will probably be fixed)<br />
<br />
An image file can be supplied on the commandline (or, i assume, drag-and-drop onto the script's desktop icon).  Otherwise a file chooser opens automatically.<br />
<br />
I'm guessing this version will probably not work in Windows for now.  Also obviously needs a lot of tweaks and fail-safe functions.<br />
<br />
<br />
Code:<br />
#!/usr/bin/env murgaLua<br />
<br />
-- GUI for steghide &lt;steghide.sourceforge.net&gt;<br />
-- function is limited to embedding data into jpg<br />
-- 2010 mikshaw<br />
-- version 0<br />
<br />
if not arg[1] then img=fltk.fl_file_chooser("Choose a JPEG","*.jp{e,}g",nil,0) else img=arg[1] end<br />
imgdata=fltk:Fl_JPEG_Image(img)<br />
imgtest=imgdata:w() -- must be jpg<br />
if imgtest==0 then os.exit() end<br />
<br />
function write_file()<br />
if passweird:value()=="" then<br />
&nbsp;&nbsp;fltk.fl_alert("No password specified!")<br />
&nbsp;&nbsp;return<br />
end<br />
local tmp=os.tmpname()..".txt"<br />
if text:value()==1 then<br />
&nbsp;&nbsp;local out=io.open(tmp,"w")<br />
&nbsp;&nbsp;if out then<br />
&nbsp;&nbsp;&nbsp;&nbsp;out:write(textfield:value())<br />
&nbsp;&nbsp;&nbsp;&nbsp;out:close()<br />
&nbsp;&nbsp;&nbsp;&nbsp;embed=tmp <br />
&nbsp;&nbsp;end<br />
else embed=filename:value()<br />
end<br />
local rtest=io.open(embed,"r")<br />
if rtest then<br />
&nbsp;&nbsp;rtest:close()<br />
else<br />
&nbsp;&nbsp;fltk.fl_alert("can't read file "..embed)<br />
&nbsp;&nbsp;return<br />
end<br />
if overw:value()==1 then ow=" -f " else ow="" end<br />
os.execute("steghide embed -ef "..embed.." -cf "..img.." -sf "..outpoot:value().." -p "..passweird:value()..ow)<br />
os.remove(tmp)<br />
end<br />
<br />
ww=500; wh=400; bh=30<br />
w=fltk:Fl_Double_Window(ww,wh,"Steghide")<br />
<br />
tabs=fltk:Fl_Tabs(0,0,ww,wh)<br />
<br />
t1=fltk:Fl_Group(0,bh,ww,wh-bh,"image file")<br />
t1:selection_color(46)<br />
imgbox=fltk:Fl_Box(0,bh,ww,wh-bh)<br />
imgbox:align(85)<br />
imgbox:image(imgdata)<br />
fltk:Fl_End() --t1<br />
<br />
t2=fltk:Fl_Group(0,bh,ww,wh-bh,"hide data")<br />
t2:selection_color(46)<br />
file=fltk:Fl_Radio_Round_Button(10,bh*2,bh*3,bh,"file")<br />
text=fltk:Fl_Radio_Round_Button(10,bh*3,bh*3,bh,"text")<br />
filename=fltk:Fl_File_Input(10+bh*3,bh*2,ww-20-bh*4,bh)<br />
choose=fltk:Fl_Button(ww-10-bh,bh*2,bh,bh,"@&gt;")<br />
choose:callback(function()<br />
&nbsp;&nbsp;newfile=fltk.fl_file_chooser("Embed a file","*.*",nil,0)<br />
&nbsp;&nbsp;if newfile then<br />
&nbsp;&nbsp;&nbsp;&nbsp;filename:value(newfile)<br />
&nbsp;&nbsp;&nbsp;&nbsp;file:value(1)<br />
&nbsp;&nbsp;end<br />
end)<br />
textfield=fltk:Fl_Multiline_Input(15,bh*4,ww-30,wh-bh*5)<br />
fltk:Fl_End() --t2<br />
<br />
t3=fltk:Fl_Group(0,bh,ww,wh-bh,"output")<br />
t3:selection_color(46)<br />
outpoot=fltk:Fl_File_Input(10+bh*2,bh*2,ww-20-bh*2,bh,"filename")<br />
passweird=fltk:Fl_Secret_Input(10+bh*2,bh*4,ww-20-bh*2,bh,"password")<br />
save=fltk:Fl_Button(10,bh*6,bh*3,bh,"save")<br />
save:callback(write_file)<br />
overw=fltk:Fl_Round_Button(bh*4,bh*6,bh*4,bh,"overwrite file")<br />
slug=fltk:Fl_Box(ww-10,wh-10,10,10)<br />
fltk:Fl_End() --t3<br />
fltk:Fl_End() --tabs<br />
<br />
file:value(1)<br />
outname=string.gsub(img,"(.*)%..*","%1_stego.jpg")<br />
outpoot:value(outname)<br />
<br />
w:resizable(tabs)<br />
tabs:resizable(t1)<br />
tabs:resizable(t2)<br />
tabs:resizable(t3)<br />
t2:resizable(textfield)<br />
t3:resizable(slug)<br />
w:show()<br />
Fl:run()<br />
<br />
]]></description>
			<content:encoded><![CDATA[While watching Along Came a Spider last night on the telly, I noticed the school kids were playing with a "stego" program to embed and encrypt secret messages into image files.  I'd done embedded zip files before, but thought this was a more interesting and secure alternative.  After a bit of Google I found the commandline cross-platform program Steghide.  So now here's a limited GUI for it.<br />
<br />
The limitations are:<br />
1) Embedding only (extraction will probably be added later)<br />
2) JPEG container only (personal preference, unlikely to change)<br />
3) No support for most options (will be improved later)<br />
4) No way to change the image after it's loaded (will probably be fixed)<br />
<br />
An image file can be supplied on the commandline (or, i assume, drag-and-drop onto the script's desktop icon).  Otherwise a file chooser opens automatically.<br />
<br />
I'm guessing this version will probably not work in Windows for now.  Also obviously needs a lot of tweaks and fail-safe functions.<br />
<br />
<br />
Code:<br />
#!/usr/bin/env murgaLua<br />
<br />
-- GUI for steghide &lt;steghide.sourceforge.net&gt;<br />
-- function is limited to embedding data into jpg<br />
-- 2010 mikshaw<br />
-- version 0<br />
<br />
if not arg[1] then img=fltk.fl_file_chooser("Choose a JPEG","*.jp{e,}g",nil,0) else img=arg[1] end<br />
imgdata=fltk:Fl_JPEG_Image(img)<br />
imgtest=imgdata:w() -- must be jpg<br />
if imgtest==0 then os.exit() end<br />
<br />
function write_file()<br />
if passweird:value()=="" then<br />
&nbsp;&nbsp;fltk.fl_alert("No password specified!")<br />
&nbsp;&nbsp;return<br />
end<br />
local tmp=os.tmpname()..".txt"<br />
if text:value()==1 then<br />
&nbsp;&nbsp;local out=io.open(tmp,"w")<br />
&nbsp;&nbsp;if out then<br />
&nbsp;&nbsp;&nbsp;&nbsp;out:write(textfield:value())<br />
&nbsp;&nbsp;&nbsp;&nbsp;out:close()<br />
&nbsp;&nbsp;&nbsp;&nbsp;embed=tmp <br />
&nbsp;&nbsp;end<br />
else embed=filename:value()<br />
end<br />
local rtest=io.open(embed,"r")<br />
if rtest then<br />
&nbsp;&nbsp;rtest:close()<br />
else<br />
&nbsp;&nbsp;fltk.fl_alert("can't read file "..embed)<br />
&nbsp;&nbsp;return<br />
end<br />
if overw:value()==1 then ow=" -f " else ow="" end<br />
os.execute("steghide embed -ef "..embed.." -cf "..img.." -sf "..outpoot:value().." -p "..passweird:value()..ow)<br />
os.remove(tmp)<br />
end<br />
<br />
ww=500; wh=400; bh=30<br />
w=fltk:Fl_Double_Window(ww,wh,"Steghide")<br />
<br />
tabs=fltk:Fl_Tabs(0,0,ww,wh)<br />
<br />
t1=fltk:Fl_Group(0,bh,ww,wh-bh,"image file")<br />
t1:selection_color(46)<br />
imgbox=fltk:Fl_Box(0,bh,ww,wh-bh)<br />
imgbox:align(85)<br />
imgbox:image(imgdata)<br />
fltk:Fl_End() --t1<br />
<br />
t2=fltk:Fl_Group(0,bh,ww,wh-bh,"hide data")<br />
t2:selection_color(46)<br />
file=fltk:Fl_Radio_Round_Button(10,bh*2,bh*3,bh,"file")<br />
text=fltk:Fl_Radio_Round_Button(10,bh*3,bh*3,bh,"text")<br />
filename=fltk:Fl_File_Input(10+bh*3,bh*2,ww-20-bh*4,bh)<br />
choose=fltk:Fl_Button(ww-10-bh,bh*2,bh,bh,"@&gt;")<br />
choose:callback(function()<br />
&nbsp;&nbsp;newfile=fltk.fl_file_chooser("Embed a file","*.*",nil,0)<br />
&nbsp;&nbsp;if newfile then<br />
&nbsp;&nbsp;&nbsp;&nbsp;filename:value(newfile)<br />
&nbsp;&nbsp;&nbsp;&nbsp;file:value(1)<br />
&nbsp;&nbsp;end<br />
end)<br />
textfield=fltk:Fl_Multiline_Input(15,bh*4,ww-30,wh-bh*5)<br />
fltk:Fl_End() --t2<br />
<br />
t3=fltk:Fl_Group(0,bh,ww,wh-bh,"output")<br />
t3:selection_color(46)<br />
outpoot=fltk:Fl_File_Input(10+bh*2,bh*2,ww-20-bh*2,bh,"filename")<br />
passweird=fltk:Fl_Secret_Input(10+bh*2,bh*4,ww-20-bh*2,bh,"password")<br />
save=fltk:Fl_Button(10,bh*6,bh*3,bh,"save")<br />
save:callback(write_file)<br />
overw=fltk:Fl_Round_Button(bh*4,bh*6,bh*4,bh,"overwrite file")<br />
slug=fltk:Fl_Box(ww-10,wh-10,10,10)<br />
fltk:Fl_End() --t3<br />
fltk:Fl_End() --tabs<br />
<br />
file:value(1)<br />
outname=string.gsub(img,"(.*)%..*","%1_stego.jpg")<br />
outpoot:value(outname)<br />
<br />
w:resizable(tabs)<br />
tabs:resizable(t1)<br />
tabs:resizable(t2)<br />
tabs:resizable(t3)<br />
t2:resizable(textfield)<br />
t3:resizable(slug)<br />
w:show()<br />
Fl:run()<br />
<br />
]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[MurgaLua version fully source compatible with 5.1.4?]]></title>
			<link>http://www.murga-projects.com/forum/showthread.php?tid=375</link>
			<pubDate>Fri, 26 Mar 2010 16:41:47 -0600</pubDate>
			<guid isPermaLink="false">http://www.murga-projects.com/forum/showthread.php?tid=375</guid>
			<description><![CDATA[Built MurgaLua with LuaJIT 1.x a couple years ago.  Fast and compatible.<br />
I'm interested in building a version of MurgaLua with LuaJIT 2.0 (as it evolves)<br />
Is there a stable source-available version of MurgaLua available that's fully compatible with 5.1.4?<br />
The LuaJIT 2 beta is very zippy, but MurgaLua .70 is binary-only so far, and afaik the most recent MurgaLua source distribution precedes 5.1.4. Is MurgaLua source available that might be compatible?<br />
<br />
Thanks much,<br />
<br />
--Foozle]]></description>
			<content:encoded><![CDATA[Built MurgaLua with LuaJIT 1.x a couple years ago.  Fast and compatible.<br />
I'm interested in building a version of MurgaLua with LuaJIT 2.0 (as it evolves)<br />
Is there a stable source-available version of MurgaLua available that's fully compatible with 5.1.4?<br />
The LuaJIT 2 beta is very zippy, but MurgaLua .70 is binary-only so far, and afaik the most recent MurgaLua source distribution precedes 5.1.4. Is MurgaLua source available that might be compatible?<br />
<br />
Thanks much,<br />
<br />
--Foozle]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[SQLite in Lua, Lua in SQLite]]></title>
			<link>http://www.murga-projects.com/forum/showthread.php?tid=374</link>
			<pubDate>Fri, 26 Mar 2010 10:52:16 -0600</pubDate>
			<guid isPermaLink="false">http://www.murga-projects.com/forum/showthread.php?tid=374</guid>
			<description><![CDATA[Hi!<br />
<br />
When I read about PL/Lua (http://pllua.projects.postgresql.org/), a loadable version of lua in PostGreSQL, I started looking for something similar for sqlite. So I came across this link (http://www.sqlite.org/cvstrac/wiki?p=ProceduralLanguage) indicating someone already made it.<br />
<br />
Maybe it would be an interesting patch to include in some future release?<br />
<br />
BTW, how's the current release going?<br />
<br />
Greets,<br />
<br />
JP]]></description>
			<content:encoded><![CDATA[Hi!<br />
<br />
When I read about PL/Lua (http://pllua.projects.postgresql.org/), a loadable version of lua in PostGreSQL, I started looking for something similar for sqlite. So I came across this link (http://www.sqlite.org/cvstrac/wiki?p=ProceduralLanguage) indicating someone already made it.<br />
<br />
Maybe it would be an interesting patch to include in some future release?<br />
<br />
BTW, how's the current release going?<br />
<br />
Greets,<br />
<br />
JP]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[real time activity]]></title>
			<link>http://www.murga-projects.com/forum/showthread.php?tid=373</link>
			<pubDate>Mon, 18 Jan 2010 09:26:31 -0700</pubDate>
			<guid isPermaLink="false">http://www.murga-projects.com/forum/showthread.php?tid=373</guid>
			<description><![CDATA[Got a question...<br />
I'm trying to gather the output of a system command and display it in a browser object, however, if the command takes a while the window will not appear (with the browser object in it) until the command is complete.. even-though the command is producing output.  Actually the output window will start to appear, depending on the command, but won't fully paint.  For example doing a ping or traceroute and showing the output as it is produced.  Is there a better/recommended way to do this:<br />
<br />
function execute_cmd()<br />
  local fh = io.popen( cmd );<br />
  if ( fh ) then<br />
    output_window:show();<br />
    while true do<br />
      local data = fh:read( "*l" );<br />
      if data == nil then break end<br />
      br_output:add( data );<br />
      output_window:redraw();<br />
      br_output:redraw();<br />
    end<br />
    fh:close();<br />
  end<br />
end<br />
<br />
Thanks,<br />
-Craig]]></description>
			<content:encoded><![CDATA[Got a question...<br />
I'm trying to gather the output of a system command and display it in a browser object, however, if the command takes a while the window will not appear (with the browser object in it) until the command is complete.. even-though the command is producing output.  Actually the output window will start to appear, depending on the command, but won't fully paint.  For example doing a ping or traceroute and showing the output as it is produced.  Is there a better/recommended way to do this:<br />
<br />
function execute_cmd()<br />
  local fh = io.popen( cmd );<br />
  if ( fh ) then<br />
    output_window:show();<br />
    while true do<br />
      local data = fh:read( "*l" );<br />
      if data == nil then break end<br />
      br_output:add( data );<br />
      output_window:redraw();<br />
      br_output:redraw();<br />
    end<br />
    fh:close();<br />
  end<br />
end<br />
<br />
Thanks,<br />
-Craig]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[http server responses]]></title>
			<link>http://www.murga-projects.com/forum/showthread.php?tid=372</link>
			<pubDate>Sun, 10 Jan 2010 11:46:53 -0700</pubDate>
			<guid isPermaLink="false">http://www.murga-projects.com/forum/showthread.php?tid=372</guid>
			<description><![CDATA[I was just curious to discover what kind of data can be retrieved from a web server, and what uses that data has.  First test, a table containing the error codes listed at W3C.  I might dip into finding uses for the headers next, although a brief search shows that there are a lot of them.<br />
<br />
<br />
Code:<br />
#!/usr/bin/env murgaLua<br />
<br />
server="http://localhost/"<br />
<br />
errors={<br />
[400]="Bad Request",<br />
[401]="Unauthorized",<br />
[403]="Forbidden",<br />
[404]="Not Found",<br />
[405]="Method Not Allowed",<br />
[406]="Not Acceptable",<br />
[407]="Proxy Authentication Required",<br />
[408]="Request Timeout",<br />
[409]="Conflict",<br />
[410]="Gone",<br />
[411]="Length Required",<br />
[412]="Precondition Failed",<br />
[413]="Request Entity Too Large",<br />
[414]="Request-URI Too Long",<br />
[415]="Unsupported Media Type",<br />
[416]="Requested Range Not Satisfiable",<br />
[417]="Expectation Failed",<br />
[500]="Internal Server Error",<br />
[501]="Not Implemented",<br />
[502]="Bad Gateway",<br />
[503]="Service Unavailable",<br />
[504]="Gateway Timeout",<br />
[505]="HTTP Version Not Supported"<br />
}<br />
<br />
-- change this to whatever url you want to test<br />
body,code,header=socket.http.request(server.."nonexistent.html")<br />
<br />
print"__________________________________"<br />
print("Code returned by server:&#92;n"..code)<br />
if errors[code] then print("Error: "..errors[code]) end<br />
print"__________________________________"<br />
print("Headers:")<br />
for k,v in pairs(header) do print(k,v) end<br />
print"__________________________________"<br />
print("Document text:&#92;n"..body)<br />
<br />
]]></description>
			<content:encoded><![CDATA[I was just curious to discover what kind of data can be retrieved from a web server, and what uses that data has.  First test, a table containing the error codes listed at W3C.  I might dip into finding uses for the headers next, although a brief search shows that there are a lot of them.<br />
<br />
<br />
Code:<br />
#!/usr/bin/env murgaLua<br />
<br />
server="http://localhost/"<br />
<br />
errors={<br />
[400]="Bad Request",<br />
[401]="Unauthorized",<br />
[403]="Forbidden",<br />
[404]="Not Found",<br />
[405]="Method Not Allowed",<br />
[406]="Not Acceptable",<br />
[407]="Proxy Authentication Required",<br />
[408]="Request Timeout",<br />
[409]="Conflict",<br />
[410]="Gone",<br />
[411]="Length Required",<br />
[412]="Precondition Failed",<br />
[413]="Request Entity Too Large",<br />
[414]="Request-URI Too Long",<br />
[415]="Unsupported Media Type",<br />
[416]="Requested Range Not Satisfiable",<br />
[417]="Expectation Failed",<br />
[500]="Internal Server Error",<br />
[501]="Not Implemented",<br />
[502]="Bad Gateway",<br />
[503]="Service Unavailable",<br />
[504]="Gateway Timeout",<br />
[505]="HTTP Version Not Supported"<br />
}<br />
<br />
-- change this to whatever url you want to test<br />
body,code,header=socket.http.request(server.."nonexistent.html")<br />
<br />
print"__________________________________"<br />
print("Code returned by server:&#92;n"..code)<br />
if errors[code] then print("Error: "..errors[code]) end<br />
print"__________________________________"<br />
print("Headers:")<br />
for k,v in pairs(header) do print(k,v) end<br />
print"__________________________________"<br />
print("Document text:&#92;n"..body)<br />
<br />
]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[access to media files on a LAN server]]></title>
			<link>http://www.murga-projects.com/forum/showthread.php?tid=371</link>
			<pubDate>Sat, 09 Jan 2010 19:33:11 -0700</pubDate>
			<guid isPermaLink="false">http://www.murga-projects.com/forum/showthread.php?tid=371</guid>
			<description><![CDATA[I recently spent a decent amount of time researching ways to stream media over a LAN server, and after wading through many sites talking mostly about Flash and other heavy options I eventually learned that some of the media players we all have installed already support streaming directly from a regular http/ftp link.  For a few days I was playing around with mplayer and VLC, and it always came down to having to either copy and paste URLs or use a playlist that automatically starts playing.<br />
<br />
So i decided to make a script that would bypass the need for a browser just to get a link and just run your chosen media player when you found what you wanted.<br />
<br />
Note that this might not be suitable in any situation other than what I use it for, which is a local network, and it hasn't been tested for problems that might arise as a result of the server or any of the desired files being unavailable.  Also note that it was written specifically to access one file at a time (i.e. a movie), not a playlist, and it DOES NOT SUPPORT SUBDIRECTORIES beyond what is listed in url[#] at this time.  Subdirectories might actually break it, though so far they just seem to create a blank browser.<br />
<br />
Requires a file host.."/lua_menu" which contains commands that add data to two tables, label and url.  The format is:<br />
label[1]="this is a label for dir 1"; url[1]="/this/is/the/dir/where/label1/files/live"<br />
The URL must be a directory containing regular media files only (at this point), and if the host variable doesn't end with a slash, url must begin with a slash (url begins where host leaves off).<br />
<br />
As always, bug reports and suggestions are welcome.  I know I do sloppy work with tables, so if something better is suggested (while not making lua_menu more complicated to edit) I'd like that.<br />
<br />
On a side note, it appears that Windows opens a cmd window when os.execute() is run.  Is this because I used  Progra~1 instead of trying harder to use the real path, or does that always happen with os.execute()? <br />
<br />
Yet another note: the "srt" exception was added because I have some movies with srt subtitles...they work when I play the movies locally, but they serve no purpose when accessed through the network....one of these days I'm going to find out about serving subtitle files.<br />
<br />
<br />
Code:<br />
-- USER CONFIGURATION<br />
<br />
--player="C:&#92;&#92;Progra~1&#92;&#92;SMPlayer&#92;&#92;smplayer.exe" -- Windows<br />
player="mplayer" -- Linux<br />
host="http://myhost/videos"<br />
<br />
-- END USER CONFIGURATION<br />
<br />
label={}; url={}<br />
-- retrieve the menu from server<br />
menufile,c,h=socket.http.request(host.."/lua_menu")<br />
assert(loadstring(menufile))()<br />
<br />
function get_menu()<br />
box:clear()<br />
for i,v in pairs(label) do<br />
&nbsp;&nbsp;box:add(v)<br />
end<br />
menu_up=1<br />
end<br />
<br />
function get_files()<br />
box:clear()<br />
body,code,header=socket.http.request(dir)<br />
for l in string.gmatch(body,"&lt;a href=&#92;"(.-)&#92;"") do<br />
&nbsp;&nbsp;if not string.find(l,"&#92;.srt&#36;") and not string.find(l,"&#92;/") then<br />
&nbsp;&nbsp;box:add(l)<br />
&nbsp;&nbsp;end<br />
end<br />
menu_up=0<br />
end<br />
<br />
function play()<br />
if box:value() &gt; 0 and menu_up==0 then<br />
&nbsp;&nbsp;win:hide()<br />
&nbsp;&nbsp;Fl:check()<br />
&nbsp;&nbsp;os.execute(player.." "..dir.."/"..box:text(box:value()))<br />
--&nbsp;&nbsp;os.exit()<br />
&nbsp;&nbsp;win:show()<br />
end<br />
end<br />
<br />
function menu_choice()<br />
if box:value() &gt; 0&nbsp;&nbsp;and menu_up==1 then<br />
dir=host..url[box:value()]<br />
get_files()<br />
end<br />
end<br />
<br />
ww,wh,bh=420,400,25<br />
bw=ww/3<br />
win=fltk:Fl_Window(ww,wh,"Movies")<br />
box=fltk:Fl_Hold_Browser(0,0,ww,wh-bh); box:callback(menu_choice)<br />
go=fltk:Fl_Button(0,wh-bh,bw,bh,"play"); go:callback(play)<br />
fresh=fltk:Fl_Button(bw,wh-bh,bw,bh,"menu"); fresh:callback(get_menu)<br />
no=fltk:Fl_Button(bw*2,wh-bh,bw,bh,"quit"); no:callback(function() os.exit() end)<br />
<br />
--table.sort(menu)<br />
get_menu()<br />
<br />
--win:resizable(box)<br />
win:show()<br />
Fl:run()<br />
<br />
]]></description>
			<content:encoded><![CDATA[I recently spent a decent amount of time researching ways to stream media over a LAN server, and after wading through many sites talking mostly about Flash and other heavy options I eventually learned that some of the media players we all have installed already support streaming directly from a regular http/ftp link.  For a few days I was playing around with mplayer and VLC, and it always came down to having to either copy and paste URLs or use a playlist that automatically starts playing.<br />
<br />
So i decided to make a script that would bypass the need for a browser just to get a link and just run your chosen media player when you found what you wanted.<br />
<br />
Note that this might not be suitable in any situation other than what I use it for, which is a local network, and it hasn't been tested for problems that might arise as a result of the server or any of the desired files being unavailable.  Also note that it was written specifically to access one file at a time (i.e. a movie), not a playlist, and it DOES NOT SUPPORT SUBDIRECTORIES beyond what is listed in url[#] at this time.  Subdirectories might actually break it, though so far they just seem to create a blank browser.<br />
<br />
Requires a file host.."/lua_menu" which contains commands that add data to two tables, label and url.  The format is:<br />
label[1]="this is a label for dir 1"; url[1]="/this/is/the/dir/where/label1/files/live"<br />
The URL must be a directory containing regular media files only (at this point), and if the host variable doesn't end with a slash, url must begin with a slash (url begins where host leaves off).<br />
<br />
As always, bug reports and suggestions are welcome.  I know I do sloppy work with tables, so if something better is suggested (while not making lua_menu more complicated to edit) I'd like that.<br />
<br />
On a side note, it appears that Windows opens a cmd window when os.execute() is run.  Is this because I used  Progra~1 instead of trying harder to use the real path, or does that always happen with os.execute()? <br />
<br />
Yet another note: the "srt" exception was added because I have some movies with srt subtitles...they work when I play the movies locally, but they serve no purpose when accessed through the network....one of these days I'm going to find out about serving subtitle files.<br />
<br />
<br />
Code:<br />
-- USER CONFIGURATION<br />
<br />
--player="C:&#92;&#92;Progra~1&#92;&#92;SMPlayer&#92;&#92;smplayer.exe" -- Windows<br />
player="mplayer" -- Linux<br />
host="http://myhost/videos"<br />
<br />
-- END USER CONFIGURATION<br />
<br />
label={}; url={}<br />
-- retrieve the menu from server<br />
menufile,c,h=socket.http.request(host.."/lua_menu")<br />
assert(loadstring(menufile))()<br />
<br />
function get_menu()<br />
box:clear()<br />
for i,v in pairs(label) do<br />
&nbsp;&nbsp;box:add(v)<br />
end<br />
menu_up=1<br />
end<br />
<br />
function get_files()<br />
box:clear()<br />
body,code,header=socket.http.request(dir)<br />
for l in string.gmatch(body,"&lt;a href=&#92;"(.-)&#92;"") do<br />
&nbsp;&nbsp;if not string.find(l,"&#92;.srt&#36;") and not string.find(l,"&#92;/") then<br />
&nbsp;&nbsp;box:add(l)<br />
&nbsp;&nbsp;end<br />
end<br />
menu_up=0<br />
end<br />
<br />
function play()<br />
if box:value() &gt; 0 and menu_up==0 then<br />
&nbsp;&nbsp;win:hide()<br />
&nbsp;&nbsp;Fl:check()<br />
&nbsp;&nbsp;os.execute(player.." "..dir.."/"..box:text(box:value()))<br />
--&nbsp;&nbsp;os.exit()<br />
&nbsp;&nbsp;win:show()<br />
end<br />
end<br />
<br />
function menu_choice()<br />
if box:value() &gt; 0&nbsp;&nbsp;and menu_up==1 then<br />
dir=host..url[box:value()]<br />
get_files()<br />
end<br />
end<br />
<br />
ww,wh,bh=420,400,25<br />
bw=ww/3<br />
win=fltk:Fl_Window(ww,wh,"Movies")<br />
box=fltk:Fl_Hold_Browser(0,0,ww,wh-bh); box:callback(menu_choice)<br />
go=fltk:Fl_Button(0,wh-bh,bw,bh,"play"); go:callback(play)<br />
fresh=fltk:Fl_Button(bw,wh-bh,bw,bh,"menu"); fresh:callback(get_menu)<br />
no=fltk:Fl_Button(bw*2,wh-bh,bw,bh,"quit"); no:callback(function() os.exit() end)<br />
<br />
--table.sort(menu)<br />
get_menu()<br />
<br />
--win:resizable(box)<br />
win:show()<br />
Fl:run()<br />
<br />
]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[feedback please]]></title>
			<link>http://www.murga-projects.com/forum/showthread.php?tid=370</link>
			<pubDate>Sun, 28 Jun 2009 18:51:09 -0600</pubDate>
			<guid isPermaLink="false">http://www.murga-projects.com/forum/showthread.php?tid=370</guid>
			<description><![CDATA[I'm trying to work out something useful from Fl_Positioner, and so far have something that will reposition a secondary window on the desktop according to the location of the positioner's axis in the primary window.  Unfortunately when the secondary window reaches the right or bottom side of the screen it jumps back halfway across the screen.  At this time I don't know if it's because of a bug in FLTK or a limitation of my tiling window manager.  I appreciate any feedback from people using more traditional desktop environments.<br />
<br />
<br />
Code:<br />
ww=Fl:w()/4<br />
wh=Fl:h()/4<br />
<br />
w=fltk:Fl_Double_Window(ww,wh+50,"positioner.lua")<br />
w:callback(function() os.exit() end) -- forces both windows to close<br />
<br />
posy=fltk:Fl_Positioner(0,0,ww,wh,"fltk:Fl_Positioner")<br />
<br />
posy_xvalue=fltk:Fl_Output(0,wh+25,ww/2,25)<br />
posy_yvalue=fltk:Fl_Output(ww/2,wh+25,ww/2,25)<br />
<br />
posy:xstep(1)<br />
posy:ystep(1)<br />
posy:xbounds(0,Fl:w()) -- uses screen sizes for maximum values<br />
posy:ybounds(0,Fl:h())<br />
<br />
posy:callback(<br />
function()<br />
&nbsp;&nbsp;posy_xvalue:value(" X: "..posy:xvalue())<br />
&nbsp;&nbsp;posy_yvalue:value(" Y: "..posy:yvalue())<br />
&nbsp;&nbsp;w2:position(posy:xvalue(),posy:yvalue()) -- set w2 position on desktop<br />
end<br />
)<br />
fltk:Fl_End()<br />
w2=fltk:Fl_Window(0,0,8,8)<br />
w2:color(1)<br />
w2:border(0)<br />
w2:box(fltk.FL_UP_BOX)<br />
fltk:Fl_End()<br />
w:show()<br />
w2:show()<br />
Fl:run()<br />
<br />
]]></description>
			<content:encoded><![CDATA[I'm trying to work out something useful from Fl_Positioner, and so far have something that will reposition a secondary window on the desktop according to the location of the positioner's axis in the primary window.  Unfortunately when the secondary window reaches the right or bottom side of the screen it jumps back halfway across the screen.  At this time I don't know if it's because of a bug in FLTK or a limitation of my tiling window manager.  I appreciate any feedback from people using more traditional desktop environments.<br />
<br />
<br />
Code:<br />
ww=Fl:w()/4<br />
wh=Fl:h()/4<br />
<br />
w=fltk:Fl_Double_Window(ww,wh+50,"positioner.lua")<br />
w:callback(function() os.exit() end) -- forces both windows to close<br />
<br />
posy=fltk:Fl_Positioner(0,0,ww,wh,"fltk:Fl_Positioner")<br />
<br />
posy_xvalue=fltk:Fl_Output(0,wh+25,ww/2,25)<br />
posy_yvalue=fltk:Fl_Output(ww/2,wh+25,ww/2,25)<br />
<br />
posy:xstep(1)<br />
posy:ystep(1)<br />
posy:xbounds(0,Fl:w()) -- uses screen sizes for maximum values<br />
posy:ybounds(0,Fl:h())<br />
<br />
posy:callback(<br />
function()<br />
&nbsp;&nbsp;posy_xvalue:value(" X: "..posy:xvalue())<br />
&nbsp;&nbsp;posy_yvalue:value(" Y: "..posy:yvalue())<br />
&nbsp;&nbsp;w2:position(posy:xvalue(),posy:yvalue()) -- set w2 position on desktop<br />
end<br />
)<br />
fltk:Fl_End()<br />
w2=fltk:Fl_Window(0,0,8,8)<br />
w2:color(1)<br />
w2:border(0)<br />
w2:box(fltk.FL_UP_BOX)<br />
fltk:Fl_End()<br />
w:show()<br />
w2:show()<br />
Fl:run()<br />
<br />
]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[JNLua (Java Native Lua)]]></title>
			<link>http://www.murga-projects.com/forum/showthread.php?tid=369</link>
			<pubDate>Wed, 24 Jun 2009 20:17:32 -0600</pubDate>
			<guid isPermaLink="false">http://www.murga-projects.com/forum/showthread.php?tid=369</guid>
			<description><![CDATA[Any chance of including this in murgalua?<br />
<br />
I'm not a big fan of java, but you have to admit it's an industry standard and there are cross-platform compiled libraries available for just about anything you might want to do and they are often documented with examples!  <br />
<br />
The average lua programmer would have a major bitch of a time finding, compiling and deciphering things like the google or yahoo APIs for C.  But with JNLua integrated into murgalua, it would be almost simple.  All you need is the JRE installed and the proper JARS in your classpath.]]></description>
			<content:encoded><![CDATA[Any chance of including this in murgalua?<br />
<br />
I'm not a big fan of java, but you have to admit it's an industry standard and there are cross-platform compiled libraries available for just about anything you might want to do and they are often documented with examples!  <br />
<br />
The average lua programmer would have a major bitch of a time finding, compiling and deciphering things like the google or yahoo APIs for C.  But with JNLua integrated into murgalua, it would be almost simple.  All you need is the JRE installed and the proper JARS in your classpath.]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Alien is complicated]]></title>
			<link>http://www.murga-projects.com/forum/showthread.php?tid=368</link>
			<pubDate>Mon, 22 Jun 2009 17:29:52 -0600</pubDate>
			<guid isPermaLink="false">http://www.murga-projects.com/forum/showthread.php?tid=368</guid>
			<description><![CDATA[I'm still trying to get my head around Alien...looks like something that could open some pretty huge doors.  I got a funny error message at one point when fooling around:<br />
<br />
Code:<br />
gtkMsgBox.lua:11: bad argument #1 to 'tostring' (userdata expected, got userdata)<br />
<br />
<br />
One of my systems has Gtk2 installed in /opt, so the alien.load function in the gtk test doesn't work since it uses a full path to the file.  Removing "/usr/lib" (using just the name of the library) fixed it.<br />
<br />
I've been trying to find out if alien can supply a list of functions available in a given library, but haven't had much luck so far.  When making changes to the gtk test I eventually got something, but it doesn't look like gtk functions.  I'm just poking at it for now.<br />
<br />
<br />
Code:<br />
local gtk,p,i=alien.load("libgtk-x11-2.0.so.0"),"pointer","int"<br />
gtk_tab=getmetatable(gtk)<br />
for i,v in pairs(gtk_tab) do <br />
gtk_tab2=getmetatable(i) end<br />
for i,v in pairs(gtk_tab2.__index) do print(i,v,type(v)) end<br />
<br />
The result:<br />
<br />
Code:<br />
sub&nbsp;&nbsp;&nbsp;&nbsp; function: 0x8262ef8&nbsp;&nbsp;&nbsp;&nbsp; function<br />
upper&nbsp;&nbsp; function: 0x8262f28&nbsp;&nbsp;&nbsp;&nbsp; function<br />
len&nbsp;&nbsp;&nbsp;&nbsp; function: 0x8262df0&nbsp;&nbsp;&nbsp;&nbsp; function<br />
gfind&nbsp;&nbsp; function: 0x8262d80&nbsp;&nbsp;&nbsp;&nbsp; function<br />
rep&nbsp;&nbsp;&nbsp;&nbsp; function: 0x8262e90&nbsp;&nbsp;&nbsp;&nbsp; function<br />
find&nbsp;&nbsp;&nbsp;&nbsp;function: 0x8262cd8&nbsp;&nbsp;&nbsp;&nbsp; function<br />
match&nbsp;&nbsp; function: 0x8262e58&nbsp;&nbsp;&nbsp;&nbsp; function<br />
char&nbsp;&nbsp;&nbsp;&nbsp;function: 0x8260878&nbsp;&nbsp;&nbsp;&nbsp; function<br />
dump&nbsp;&nbsp;&nbsp;&nbsp;function: 0x8262ca0&nbsp;&nbsp;&nbsp;&nbsp; function<br />
gmatch&nbsp;&nbsp;function: 0x8262d80&nbsp;&nbsp;&nbsp;&nbsp; function<br />
reverse function: 0x8262ec0&nbsp;&nbsp;&nbsp;&nbsp; function<br />
byte&nbsp;&nbsp;&nbsp;&nbsp;function: 0x8260840&nbsp;&nbsp;&nbsp;&nbsp; function<br />
format&nbsp;&nbsp;function: 0x8262d10&nbsp;&nbsp;&nbsp;&nbsp; function<br />
gsub&nbsp;&nbsp;&nbsp;&nbsp;function: 0x8262db8&nbsp;&nbsp;&nbsp;&nbsp; function<br />
lower&nbsp;&nbsp; function: 0x8262e20&nbsp;&nbsp;&nbsp;&nbsp; function<br />
<br />
That looks like functions in string rather than gtk]]></description>
			<content:encoded><![CDATA[I'm still trying to get my head around Alien...looks like something that could open some pretty huge doors.  I got a funny error message at one point when fooling around:<br />
<br />
Code:<br />
gtkMsgBox.lua:11: bad argument #1 to 'tostring' (userdata expected, got userdata)<br />
<br />
<br />
One of my systems has Gtk2 installed in /opt, so the alien.load function in the gtk test doesn't work since it uses a full path to the file.  Removing "/usr/lib" (using just the name of the library) fixed it.<br />
<br />
I've been trying to find out if alien can supply a list of functions available in a given library, but haven't had much luck so far.  When making changes to the gtk test I eventually got something, but it doesn't look like gtk functions.  I'm just poking at it for now.<br />
<br />
<br />
Code:<br />
local gtk,p,i=alien.load("libgtk-x11-2.0.so.0"),"pointer","int"<br />
gtk_tab=getmetatable(gtk)<br />
for i,v in pairs(gtk_tab) do <br />
gtk_tab2=getmetatable(i) end<br />
for i,v in pairs(gtk_tab2.__index) do print(i,v,type(v)) end<br />
<br />
The result:<br />
<br />
Code:<br />
sub&nbsp;&nbsp;&nbsp;&nbsp; function: 0x8262ef8&nbsp;&nbsp;&nbsp;&nbsp; function<br />
upper&nbsp;&nbsp; function: 0x8262f28&nbsp;&nbsp;&nbsp;&nbsp; function<br />
len&nbsp;&nbsp;&nbsp;&nbsp; function: 0x8262df0&nbsp;&nbsp;&nbsp;&nbsp; function<br />
gfind&nbsp;&nbsp; function: 0x8262d80&nbsp;&nbsp;&nbsp;&nbsp; function<br />
rep&nbsp;&nbsp;&nbsp;&nbsp; function: 0x8262e90&nbsp;&nbsp;&nbsp;&nbsp; function<br />
find&nbsp;&nbsp;&nbsp;&nbsp;function: 0x8262cd8&nbsp;&nbsp;&nbsp;&nbsp; function<br />
match&nbsp;&nbsp; function: 0x8262e58&nbsp;&nbsp;&nbsp;&nbsp; function<br />
char&nbsp;&nbsp;&nbsp;&nbsp;function: 0x8260878&nbsp;&nbsp;&nbsp;&nbsp; function<br />
dump&nbsp;&nbsp;&nbsp;&nbsp;function: 0x8262ca0&nbsp;&nbsp;&nbsp;&nbsp; function<br />
gmatch&nbsp;&nbsp;function: 0x8262d80&nbsp;&nbsp;&nbsp;&nbsp; function<br />
reverse function: 0x8262ec0&nbsp;&nbsp;&nbsp;&nbsp; function<br />
byte&nbsp;&nbsp;&nbsp;&nbsp;function: 0x8260840&nbsp;&nbsp;&nbsp;&nbsp; function<br />
format&nbsp;&nbsp;function: 0x8262d10&nbsp;&nbsp;&nbsp;&nbsp; function<br />
gsub&nbsp;&nbsp;&nbsp;&nbsp;function: 0x8262db8&nbsp;&nbsp;&nbsp;&nbsp; function<br />
lower&nbsp;&nbsp; function: 0x8262e20&nbsp;&nbsp;&nbsp;&nbsp; function<br />
<br />
That looks like functions in string rather than gtk]]></content:encoded>
		</item>
	</channel>
</rss>