Murga-Projects Forums
[WIP] MurgaLua Reference Tool - Printable Version

+- Murga-Projects Forums (http://www.murga-projects.com/forum)
+-- Forum: Project Forums (/forumdisplay.php?fid=1)
+--- Forum: MurgaLua - General (/forumdisplay.php?fid=2)
+--- Thread: [WIP] MurgaLua Reference Tool (/showthread.php?tid=93)


[WIP] MurgaLua Reference Tool - mikshaw - 07-10-2007 05:00 PM

Latest update: 1 April 2008


In the Days Before MurgaLua [last year =o)], I had built a gui tool for Lua-FLTK reference. It was designed to display various types of FLTK widgets along with the script used to create those widgets, so a user (and me) could quickly refer to it whenever the need arose to be reminded of the syntax of a particular type of widget. I found it much more convenient than referring only to the FLTK manual or other completed scripts, since the manual focuses on C++ rather than Lua and full scripts are often too complex to easily find what I was looking for. The act of writing the tool was a learning experience in itself as well.

To the point....I started working on a similar tool for MurgaLua today. It is a murgaLua script itself, so all code will be open.

I was thinking of including a few bits that have been posted by others in this forum, but would like to know if I have the permission to do so. If it's okay, please let me know. Specifically, I think that would be John, Bill, and Marielle (and Robert S., if you happen to read this).

Also, if anyone would like to contribute code, particularly for widgets I find confusing (Fl_Scroll, Fl_Wizard, Fl_Menu_Item come to mind), or other bits of code that could be seen as "handy tricks" or simply are not found in every murgaLua script in existence (i think standard button usage has been covered well enough), they would also be greatly appreciated.

Ideally code would be of the "keep it simple" variety, and well commented, as this is to be used not only as a reference for current programmers but also as a learning tool for beginners. While it currently focuses on FLTK, it might be expanded to non-FLTK parts of murgaLua in the future.

Proper credit will of course be displayed prominently.

Thank you for your time.

murgaLua_demos-beta4.tar.gz


RE: [WIP] MurgaLua Reference Tool - a little help? - iGame3D - 07-10-2007 07:20 PM

You can definately use anything I post. My work is not 'well commented' because
I don't know what I'm doing well enough to explain it someone else.

I have noticed that everyone posts what appears to be hand scripted GUI's.
I use Fluid for my stuff and rip it through the converter because the widget
syntax is still fairly alien to me. That of course has a drawback in things
that the converter doesn't handle like menus/submenus.

Do you have an outline of what you'll be covering?


RE: [WIP] MurgaLua Reference Tool - a little help? - mikshaw - 07-11-2007 01:56 AM

Quote:
You can definately use anything I post.

Thank you =o)

Quote:
My work is not 'well commented' because I don't know what I'm doing well enough to explain it someone else.

Notice I said "ideally" =o)

Quote:
Do you have an outline of what you'll be covering?

I hope to at least include one example of each murgaLua-supported item listed in the "Class Reference" and "Function Reference" sections of the FLTK docs. The examples will range in complexity from simply displaying a widget (Fl_Clock) to very basic applications (use a file selector to load/save text). Whether or not they will get much more complex than that is currently undecided. For now the only plan is to show every supported widget.

Quote:
I have noticed that everyone posts what appears to be hand scripted GUI's.

Personally I have very little interest in Fluid. I don't trust WYSIWYG tools to create clean, simple code. I've seen it with HTML editors, such as Dreamweaver and Frontpage, where manual editing the file afterward is a huge pain in the butt, and have heard the same applies with other tools. I also do not care to be made to do things the way a tool tells me it should be done.
The main thing about hand-coding, for me, is that I feel more comfortable in knowing how to write scripts. Maybe it's a bit elitist, but I think a programmer/scripter should know and understand his language as well as he can, not only for the sake of greater general knowledge but for an increased ability to solve problems and fine-tune the program's behavior.


RE: [WIP] MurgaLua Reference Tool - a little help? - iGame3D - 07-11-2007 09:57 AM

This document might come in handy.
fltk graphics instructions

I processed it to match the murga-style FLTK commands rather than the C++
nastiness that the original docs are in. Makes for easier copy and paste.

Links in the doc don't work though, guess I'll have to remember exactly
what  I did to make it conform and process the whole of FLTK docs
into a suitable mass of information.


RE: [WIP] MurgaLua Reference Tool - a little help? - mikshaw - 07-11-2007 03:22 PM

Wow, that's really cool. I had no idea there were so many drawing functions available.

As far as the links go, I just ran it through sed to remove all instances of the leading directory path, saved it to the same directory as the rest of the FLTK docs and now it works fine.


RE: [WIP] MurgaLua Reference Tool - a little help? - roberts - 07-12-2007 02:20 AM

Hi Mikshaw,

Feel free to use part(s) of the murgaLua scripts that I have created for Damn Small Linux. As I am sure you are aware, DSL, has used Lua and Lua-Fltk for quite some time. In fact, DSL has over 50 such programs, covering file processing, sockets, and many GUIs. When murgaLua came on the scene, I converted, at that time, 54 Lua and Lua/Fltk scripts to murgaLua.

I wish I had more time to do more to help you with this, but at the moment I am very busy with the DSL distribution.

I am always looking forward to incorporating your scripts or any other member here into DSL. There are still many Lua GUI's to build.

Lua is the main language used in DSL.

-- Robert


RE: [WIP] MurgaLua Reference Tool - a little help? - mikshaw - 07-12-2007 08:18 AM

Thank you. There is much in DSL that has greatly impressed me.

The Lua-FLTK reference package was quite a bit different than this one, particularly in the sense that this one will be read-only rather than having the ability to edit code samples and save as a new file. That feature may have been handy for some, but I found that I never used it and it seemed to just add unnecessary complexity. At this time, the code samples load into a browser, but I think it would probably be better to use Fl_Multiline_Output() so you could select specific parts.

I got kind of sidetracked yesterday digging into new little bits of code that i kept running into, and almost got _very_ sidetracked into studying the drawing functions (but that will take some time to absorb, and I don't think i'm ready yet), and didn't do much work adding to the widget collection.

I'm trying to keep the main script as simple as possible, although over time my scripts tend to get more complex than I would like. Right now I'm still debating whether to keep the current method of using dofile() on all included widget files when the script first runs, or go back to trying my original (so far unsuccessful) plan of loading each widget only when needed. The original plan would definitely be better, but for some reason replacing widgets/groups dynamically seems to be somewhat limited (possibly to particular classes?). But this particular issue can be addressed at any time, I suppose, as long as I don't add much extra code that depends on the method of loading widget files.

Anyway....I guess most of this post is just a ramble session. For now the main script works fairly well, so I guess I'll concentate on quantity for a little while.

Edit: I forgot to mention that the tool will provide a way to display a text file for each sample for any information that may not comfortably fit in as script comments, so if you have any special notes about a submitted or otherwise acquired script, feel free to donate some comments. I'll probably start posting test releases to this thread within the next couple of weeks, so if you see anything of yours included please feel free to add your comments, motivation for the script, tips on using your code, or anything else you have to say about it, and I'll put it in the text files.


RE: [WIP] MurgaLua Reference Tool - a little help? - iGame3D - 07-12-2007 08:42 PM

I was thinking, perhaps you want to have a means of exporting the samples and comments to a indexed HTML page(s) for posting to the web. Just a thought.


RE: [WIP] MurgaLua Reference Tool - a little help? - mikshaw - 07-13-2007 01:59 AM

That's not a bad idea. I'm not sure what the term "indexed HTML" means, but it could at least export text files with little trouble. Any formatting to other types of text could be added at any time in the future.
Last night I had changed the Fl_Browser to Fl_Multiline_Output (for displaying code and notes) in order to allow selecting arbitrary bits of text. However, the output widget has an annoying tendancy to beep at me if I accidently press a hotkey without holding Alt while the text field has focus (which is every time a file gets loaded into it). So I thought it might be better just to make it an Input instead. This would also require Alt+hotkey rather than just hotkey in order to prevent accidentally inserting text into the sample, but there will be no annoying beep, and would allow a feature to save a modified version of the script sample to a new file with only a fraction of the added code that I had estimated. Maybe I need to study Fl_Text_Editor...it could be a better alternative to Fl_Multiline_Input.[attachment=10]


RE: [WIP] MurgaLua Reference Tool - a little help? - iGame3D - 07-13-2007 03:34 AM

Looking good.

By indexed HTML I meant where a list of relevant links are on one side of the page and the content that it links to pops up on the other side of the page.

I suppose people use that CSS stuff for that now, I never fell in love with mark up languages so I'm still stuck in 1997 when it comes to web page stuffs.


RE: [WIP] MurgaLua Reference Tool - a little help? - mikshaw - 07-13-2007 05:40 AM

Quote:
a list of relevant links are on one side of the page and the content that it links to pops up on the other side of the page.

That sounds like frames, which I have grown to dislike greatly, or as you said CSS. If it does export HTML it will likely be css-enabled (although not css-dependent), since css is another thing that I have been studying and playing with over the last several months and I find it an easy way to beautify and organize the content of a group of pages.

My HTML at one time was targeted toward making whatever I could to appear unique and blingy...flash, javascript, lots of graphics, complex frames...but over time I began to head in the opposite direction, aiming for simplicity in all things. Most of the time I prefer plain text, with only a small taste of graphics (small in size and subtle in appearance). The ultimate HTML goal for me is that everything should be standards compliant, fast loading, and viewable in as many browsers as possible (which especially means no client-side scripting or plugins). So the CSS would enhance the experience slightly for those browsers that support it, but would not suffer from loss of content or ugly layout for those that don't.


RE: [WIP] MurgaLua Reference Tool - a little help? - mikshaw - 07-27-2007 12:35 AM

Small update:

I'm continuing to work on the project at least a few minutes every day, so it is progressing. With each new piece, though, I'm finding new things that I have to learn (or relearn in a different way from Lua-FLTK) so progress has been slow. Also ran into a snag which required a rewrite of the widget-loading mechanism, but that was something I had been expecting to do since near the beginning.

The original "a few weeks" might turn into "a month or so" or maybe longer, so from this point on I'm not going to even hint at a time for release until it's ready for testing and feedback.

Current features include editing script samples and previewing the edits, saving samples (edited or not) to new files, changing scheme and font size (of loaded text files only, at least for now), and quick access to FLTK and Lua manuals and a page of miscellaneous code snippets. That's not a lot, but as I said I want to keep it simple. Still less than 30 widgets have been implemented, but that number will continue to grow.

The preview/save functions need more work. For now all changes are lost even if you do something as simple as checking out the readme while editing. This is a low priority, though.


RE: [WIP] MurgaLua Reference Tool - a little help? - JohnMurga - 07-27-2007 12:55 AM

Even if I can't include it I would LOVE to see what you have so far :-)

Cheers
JohnM


RE: [WIP] MurgaLua Reference Tool - a little help? - mikshaw - 07-27-2007 03:18 AM

Well, just keep in mind that some parts of this package ARE BROKEN AND INCOMPLETE.
I've removed the docs directory to minimize the file size for now. They add something in the area of 700k to the compressed archive.

Also note that I plan to change the license to something OSI approved, and that I made an assumption about what iGame3D's name is =o)

That said, here it is in its most recent state
[removed]


RE: [WIP] MurgaLua Reference Tool - a little help? - iGame3D - 07-27-2007 05:01 AM

mikshaw Wrote:
Also note that I plan to change the license to something OSI approved, and that I made an assumption about what iGame3D's name is =o)


eh?

Ok its looking good.
After a widget is previewed and a second widget is chosen it exits the window without any message. murgaLua continues running, and no error goes to console.


RE: [WIP] MurgaLua Reference Tool - a little help? - mikshaw - 07-27-2007 05:35 AM

Quote:
After a widget is previewed and a second widget is chosen it exits the window without any message. murgaLua continues running, and no error goes to console.

Thanks for the heads up. It doesn't do that for me, though. Maybe it's a particular widget?


RE: [WIP] MurgaLua Reference Tool - a little help? - iGame3D - 07-27-2007 07:30 AM

Everything I tested so far, and I've been picking them randomly.
Is there anything in the code that tells the window to close or hide?


RE: [WIP] MurgaLua Reference Tool - a little help? - mikshaw - 07-27-2007 08:54 AM

No, but I imagine there could be without too much trouble. I think I should probably rethink the way the preview is done...maybe even use a new instance of murgaLua for it.

Here's the way it currently works:
Each widget file is a semi-complete script, without the window creation and fltk:Fl:run().
When the widget is called, the previous widget (if it exists) is removed.
A new child window is created and the widget file is added within that window with dofile().
This process causes everything in the widget file to become a part of the main window.
The preview is done by creating a new script in ram with the contents of the text window, which is run with assert(loadstring(tempscript))(). This might be the problem, since I don't fully understand assert or loadstring. It might be better to simply create a new external window for the preview, which I think could be more easily controlled.

So far I haven't done anything with it since the last post, so I'm just speculating.


RE: [WIP] MurgaLua Reference Tool - a little help? - iGame3D - 07-27-2007 10:11 AM

The way it currently shows things in the main window is kind of cool, but perhaps it would be better to create a new or semi-newish "Example" window, while still being able to look at documentation and the script etc in the main window.

Its worth a shot.
Don't think you need any hiders or closers, except to demonstrate that kind of call...and in that case you will certainly need a new window or poof there goes the sample.

Its impressive, I was kind of heading down the same pay with my console gizmo, which I'll try to hack your widget demo into eventually.


RE: [WIP] MurgaLua Reference Tool - a little help? - mikshaw - 07-27-2007 01:43 PM

I think you're right. It would probably also solve the problem of losing edits. That's the method I used with the Lua-FLTK version, and it seemed to work fine. I just have this thing about trying to keep away from having multiple windows within the same application (the Gimp interface, for example, is rather annoying to me)


RE: [WIP] MurgaLua Reference Tool - a little help? - iGame3D - 07-27-2007 03:06 PM

That was a major struggle with several versions of iGame3D.

What tended to happen was what seemed like a perfect single window solution fell to pieces the moment a more complicated action was developed and included.

Just thinking of all the iterations I've gone through wears me down.
Don't let it happen to you. :-)


RE: [WIP] MurgaLua Reference Tool - a little help? - mikshaw - 08-03-2007 11:14 AM

I saw something that sounds similar to your bug yesterday. I had opened a preview window while running my window manager in "float" mode (it's usually tiled, so windows never overlap). The preview window completely covered the main window, and when I pressed Esc to close the preview the main window was gone as well, but the application was still running. I haven't been abe to recreate that situation since then.

One thing I was thinking about was the possibility of having the preview replace the current widget group in the main window instead of using loadstring() to open it in a new window (I don't really understand how loadstring works anyway). This _might_ fix the problem.

Recent changes:

Requires murgaLua 0.5.5

Using Fl_Text_Display and Fl_Text_Editor instead of Fl_Multiline_Output/Fl_Multiline_Input to display code and other text. This gives a much more pleasant interface, including scrollbars.

Started messing with drawing functions. I have most of the "fast shapes" functions covered, but I don't know if the more complicated stuff will be included any time soon.
I tried to include both the circles demo from iGame3D and the draw4 demo from John, but both presented problems due (I assume) to the nested nature of the widget application. Instead I made a new button-driven script which was based on the draw4 script. The draw4 demo works, but since it's on a loop it presents a problem when viewing the source while it's running (the drawings continue to draw over the text field). The circles demo segfaults (the version that doesn't segfault for me when running in its own window), and I haven't figured out why.

The FLTK manual was removed, since it is already included with murgaLua. That cut the package size down considerably...several hundred Ks.

The "edit code" menu item opens the code in a new window in Fl_Text_Editor instead of allowing edits to the "view code" display. The save and preview functions have been moved to this window. This allows me to use the same Fl_Text_Display for read-only viewing of all text, and moves the editable stuff to a whole different window.

Added some bitmap widgets, Fl_XBM_Image, Fl_XPM_Image, Fl_Tiled_Image, and initial tests of Fl_Bitmap. I'm hoping Fl_Gif_Image and Fl_Pixmap will be supported eventually (nudge, nudge)

Also included: Fl_Chart, align, Fl_File_Browser (incomplete), labetype (seems to be broken?), and Fl_Wizard

Still adding more things each day.


RE: [WIP] MurgaLua Reference Tool - a little help? - JohnMurga - 08-06-2007 10:10 PM

Sounds great mikshaw

Send me the code and I'll look into the issues you are having :-)

Cheers
JohnM


RE: [WIP] MurgaLua Reference Tool - a little help? - mikshaw - 08-10-2007 03:34 AM

We recently experienced back-to-back days of violent, nearly tornado-like storms (extremely rare for New England). I just got the utilities back, so haven't worked on this or any other scripting project in nearly a week.

I'll replace the previous test version with what I currently have next time I look at it.


RE: [WIP] MurgaLua Reference Tool - a little help? - mikshaw - 08-11-2007 12:33 PM

I made a boo-boo somewhere, and I don't know what it was, but now the notes feature doesn't work properly. The enable/disable of the notes menu item seems to work only for some widgets, and the notes themselves no longer display. I've looked into it a few times with no success...logically it seems that it should work.

If I can't figure it out tomorrow I'll just post it as is.


RE: [WIP] MurgaLua Reference Tool - a little help? - iGame3D - 08-12-2007 08:33 AM

Its tomorrow, the suspsense is killing me softly.


RE: [WIP] MurgaLua Reference Tool - a little help? - mikshaw - 08-12-2007 10:29 AM

ok, I didn't actually touch it today, since I had some work to do in the gardens, but here is the current package complete with annoying problems. The previous version has been deleted.
Again, the Lua documentation has been stripped to save a few Ks
(attachment removed)


RE: [WIP] MurgaLua Reference Tool - a little help? - iGame3D - 08-12-2007 11:09 AM

Its still looking good. I wonder how we can implement syntax coloring.

Your color chooser is slick, and I not that opening/closing new windows doesn't have that "whole window" disappear effect that the widgets in a single window causes.

Now if I could just get into a "i like to read code" trance I might learn something.


RE: [WIP] MurgaLua Reference Tool - a little help? - mikshaw - 08-16-2007 12:07 PM

This is seriously driving me NUTS!

I have a test for whether or not a *.txt file exists, and the result of this test determines whether or not a specific menu item is enabled. I also have a print("yes it works") command as part of the test, and this print command works every time, in the exact same place that the activate/deactivate command is found. I've gone over and over this at least several dozen times, and it makes no sense to me that the print shows when it's supposed to, but the enabling of the menu item only works sometimes.

As another test, to see if there might be an issue with enabling/disabling a menu item, I created this:

Code:
function menu_callback()
if menu:text()=="disable item 1" then itemone:deactivate()
elseif menu:text()=="enable item 1" then itemone:activate()
end
end

window = fltk:Fl_Window(400, 200, "menu test")
menu=fltk:Fl_Menu_Bar(0,0,400,30)
menu:add("file/item1")
menu:add("file/item2")
menu:add("file/item3")
menu:add("disable item 1")
menu:add("enable item 1")

menu:callback(menu_callback)

itemone=menu:find_item("file/item1")
window:show()
Fl:run()

And of course that works every time.
So i'm throwing this project aside for an indefinite period of time. I'm sick of stuggling with this one stupid issue and sick of looking at this script as a result. I'll get back to it some time later when I feel like abusing my brain.


RE: [WIP] MurgaLua Reference Tool - a little help? - JohnMurga - 08-16-2007 05:09 PM

mikshaw Wrote:
So i'm throwing this project aside for an indefinite period of time. I'm sick of stuggling with this one stupid issue and sick of looking at this script as a result. I'll get back to it some time later when I feel like abusing my brain.


I am away right now, but I am back on Monday and will take a look at this ... If only to abuse my brain :-)

Cheers
JohnM


RE: [WIP] MurgaLua Reference Tool - a little help? - mikshaw - 08-17-2007 12:21 AM

I was pissed at the thing yesterday when I posted. Since then I have apologized to the script and we are civil to each other. Whether or not this will continue when I dig into it again remains to be seen. I've tweaked and poked and tested all sorts of things thinking some part of it is just being very particular about something without logical reason. I've checked for typos several times, looked for misplaced or accidentally uncommented commands, tried redraw() on every potential change, checked the indiviual files for problems (some were blanked for some reason, which explained one of my other issues), even tried rearranging the order of commands to see if one command was overriding another. The bottom line is that I made a change at some point which broke what was previously working, and there doesn't seem to be any reason for the break.

I may need to revert to a previous version and port only the changes that I know work, but it would be super to be able to learn what went wrong so I don't end up repeating it.

Another option, of course, would be to simply remove the notes check and provide a notes file for every widget, so activate/deactivate would no longer be an issue. If I did that, though, I wouldn't be learning.


RE: [WIP] MurgaLua Reference Tool - a little help? - mikshaw - 08-17-2007 02:56 AM

I do believe I've finally stumbled upon the cause of the trouble, although I don't have a solution.

The problem was not caused by a change to the main script, as I had originally thought, but by a widget I'd added. It just so happens that this particular widget was disabled in the most recent test release (the "broken" release), so you might never see it.
It is related to a multiple-menu problem i was having (and gave up on) not long ago, but I never saw the connection because I was using two different types of menus this time.

So....the trouble comes from, as far as I can tell, one of three possible sources:
1) A bug in FLTK
2) A bug in MurgaLua
3) Poorly-made menus (my fault)

The symtom occurs when you create two menus (of any type, apparently) and then use my_second_menu:add("something") to add a menu item to the second menu. This apparently breaks the first menu, preventing you from controlling its contents. It sounds like a bug to me, considering you can use the same logic to add to other widgets (a browser for example), but maybe i'm doing something wrong.

Now that I know where the problem lies I don't have to bother shooting into the dark, so maybe I can figure out the solution....maybe it just needs fltk:Fl_End() or something simple like that.
I might just have to study the "proper" way of creating menu items (Fl_Menu_Item), although it seems like an unnecessarily complicated process.

There is another smaller issue I've bumped into, though, that coincidentally is also causing the notes item to not display when it should. If one of the widget filenames contains a hyphen, the string.find(textfile) test fails to work for that file. This wasn't a problem earlier because I was using io.open(textfile) to test if the notes file existed, and the hyphen worked then. I switched to building a string containing all *.lua.txt filenames because I thought it would save having to try opening two files every time a widget is loaded. I'm sure it will be a simple fix, but I just thought it was odd.

EDIT: the smaller issue was fixed by using a "plain" (no expressions) string.find:
string.find(string,pattern,1,1)
the second "1" (or anything true) enables a plain find, and the first "1" (starting point) is required if the second is used


RE: [WIP] MurgaLua Reference Tool - a little help? - mikshaw - 08-17-2007 05:49 AM

Update:
Replacing my_menu:add("menu item") with an Fl_Menu_Item array seems like it *should* work. It no longer causes trouble for the main menu, but I can't figure out how to create the menu item array.

According to the FLTK docs (Fl_Menu_Item), it looks like a fairly simple table, but when I try to use my_menu:menu(my_array) it doesn't seem to do anything. The FLTK docs calls the array a "structure", however, which makes me wonder. I don't know what a structure is, or whether it can be created in Lua.

I've tried this:

Code:
menuitems={
        "FL_ALIGN_CENTER",
        "FL_ALIGN_TOP",
        "FL_ALIGN_BOTTOM",
        "FL_ALIGN_LEFT",
        "FL_ALIGN_TOP_LEFT",
        "FL_ALIGN_BOTTOM_LEFT",
        "FL_ALIGN_RIGHT",
        "FL_ALIGN_TOP_RIGHT",
        "FL_ALIGN_BOTTOM_RIGHT",
        "FL_ALIGN_INSIDE",
        "FL_ALIGN_TEXT_OVER_IMAGE",
        "FL_ALIGN_CLIP",
        "FL_ALIGN_WRAP",
}

and this:

Code:
menuitems={
        {"FL_ALIGN_CENTER"},
        {"FL_ALIGN_TOP"},
        {"FL_ALIGN_BOTTOM"},
        {"FL_ALIGN_LEFT"},
        {"FL_ALIGN_TOP_LEFT"},
        {"FL_ALIGN_BOTTOM_LEFT"},
        {"FL_ALIGN_RIGHT"},
        {"FL_ALIGN_TOP_RIGHT"},
        {"FL_ALIGN_BOTTOM_RIGHT"},
        {"FL_ALIGN_INSIDE"},
        {"FL_ALIGN_TEXT_OVER_IMAGE"},
        {"FL_ALIGN_CLIP"},
        {"FL_ALIGN_WRAP"},
        {0}
}

and this:

Code:
menuitems={
        {"FL_ALIGN_CENTER", 0, 0, 0, 0},
        {"FL_ALIGN_TOP", 0, 0, 0, 0},
        {"FL_ALIGN_BOTTOM", 0, 0, 0, 0},
        {"FL_ALIGN_LEFT", 0, 0, 0, 0},
        {"FL_ALIGN_TOP_LEFT", 0, 0, 0, 0},
        {"FL_ALIGN_BOTTOM_LEFT", 0, 0, 0, 0},
        {"FL_ALIGN_RIGHT", 0, 0, 0, 0},
        {"FL_ALIGN_TOP_RIGHT", 0, 0, 0, 0},
        {"FL_ALIGN_BOTTOM_RIGHT", 0, 0, 0, 0},
        {"FL_ALIGN_INSIDE", 0, 0, 0, 0},
        {"FL_ALIGN_TEXT_OVER_IMAGE", 0, 0, 0, 0},
        {"FL_ALIGN_CLIP", 0, 0, 0, 0},
        {"FL_ALIGN_WRAP", 0, 0, 0, 0},
        {0}
}

and none work. I have no idea what else can be tried.

Update:
I found a semi-adequate solution that at least allows me to modify the appearance of existing menu items in a multi-menu script:
http://www.murga-projects.com/forum/showthread.php?tid=154


RE: [WIP] MurgaLua Reference Tool - a little help? - mikshaw - 08-19-2007 01:43 AM

The last package was deleted, as it didn't work. This is alpha 1, which should still be considered a test release. I have many more improvements and widgets to add in the future, but not sure when I'll get to it in the next several days.[attachment=15]

Note: At one point yesterday I experienced a segfault durning a widget load. I was not able to reproduce it, but I have a suspicion that it relates to the recently-added "menu removal" code which accompanied the "menu addition" code I just put in to fix my last problem.


RE: [WIP] MurgaLua Reference Tool - a little help? - chrimo - 08-19-2007 08:59 AM

Hi mikshaw,

it works at OSX 10.4.10 (PPC) when changing

Code:
demo_appdir=string.gsub(arg[0],"(.*)"..demo_sep..".*","%1") -- data directory

to

Code:
demo_appdir=".";



Cool demos, thanks  for all your work...
This will help me, while  exploring murgaLua with "try and error" very much!
Bye
Christian


RE: [WIP] MurgaLua Reference Tool - a little help? - mikshaw - 08-19-2007 09:38 AM

I got another segfault today, and decided it would be best if I stuck with only one menu for now. So I deleted the dropdown menu from the align sample and just left it with the numeric slider (the constants are now listed in the notes file for that sample).

Still adding more stuff. I got into reading about system fonts and decided to get something about that included. Finally figured out how to get a reliable font string for truetype fonts, so that was cool.

Your fix for the demo_appdir variable is what I originally had done. I changed it because I wanted to be able to run it from any directory, regardless of where the program is located. Your fix requires that you cd to the application directory before running it.
I thought OSX was based on BSD, which would mean that it has the same directory separator as Linux. What do you get when you print(arg[0]) or print(demo_appdir)? does it include a full path to the script?


RE: [WIP] MurgaLua Reference Tool - a little help? - chrimo - 08-20-2007 02:54 AM

mikshaw Wrote:
I thought OSX was based on BSD, which would mean that it has the same directory separator as Linux. What do you get when you print(arg[0]) or print(demo_appdir)? does it include a full path to the script?


Hi mirkshaw,

the answer is quite simple Big Grin
you prefer, executing widget.lua directly and use #!/usr/bin/murgaLua...

This is very easy, but not default at any system...
My binpath is /usr/local/bin/murgaLua and your default didn't work.

But when executing murgaLua widget.lua, you script fails and returns NIL.
murgaLua: widgets.lua:215: cannot open widgets.lua/script: Not a directory
stack traceback:
[C]: in function 'dir'
widgets.lua:215: in main chunk
[C]:

You have to check, from where your script is called and get different range of parameters... When executing "murgaLua widget.lua" you have an offeset of +1

Another issue, why not using #! is, when downloading and extracting to any directory, you have no execute rights for widget.lua.
This can be handled by an installer script only Big Grin

Bye
Christian


RE: [WIP] MurgaLua Reference Tool - a little help? - mikshaw - 08-20-2007 10:31 AM

Quote:
When executing "murgaLua widget.lua" you have an offeset of +1

I had no idea. I thought arg[0] *always* returned the path to the script, but I guess if the script is called as an argument to the mugaLua command it would be arg[1]. Thanks for that info. I'll have to look into it further, because I really would like to keep it so it could be run from any directory without needing to manually edit the demo_appdir variable.

Quote:
why not using #! is, when downloading and extracting to any directory, you have no execute rights for widget.lua.
This can be handled by an installer script only

This shouldn't be the case if its extracted with permissions intact. If your permissions are changed when extracting a file onto a POSIX system (linux/unix/osx), you can quickly fix it by chmodding the file +x for owner (you). All the other files included with the package do not need more than read permission.
I have a "keep it simple" mentality when it comes to distributing files. In other words, I see no reason for installer scripts for anything I make. They are simple tar.gz archives. On linux, the customs of using #!/path/to/interpreter and of making sure executable files are indeed set to be executable are widely practiced, and I have no desire to change that, since it works well.

The only thing I plan to change in this area is to hopefully make it so running the script itself and running it as an argument to the murgaLua command will result in the same behavior.


RE: [WIP] MurgaLua Reference Tool - a little help? - mikshaw - 08-21-2007 01:45 AM

Ok, I was correct in assuming that arg[0] always returns the full path to the script.
The problem comes from the way I was determining the directory path. If the script is run in the current directory as an argument to murgaLua, there is no directory separator (variable name demo_sep) in the string, and so it returns the name of the script instead.

Here's a quick fix to that, although it could probably be done better:

Code:
if string.find(arg[0],demo_sep) then
  demo_appdir=string.gsub(arg[0],"(.*)"..demo_sep..".*","%1") -- data directory
  demo_title=string.gsub(arg[0],".*"..demo_sep.."(.*)","%1")
else
  demo_appdir="."
  demo_title=arg[0]
end

It hasn't been tested on Windows yet to see if demo_sep needs to be preceded by % or yet another backslash in string.find


RE: [WIP] MurgaLua Reference Tool - a little help? - JohnMurga - 08-21-2007 04:53 PM

mikshaw Wrote:
It hasn't been tested on Windows yet to see if demo_sep needs to be preceded by % or yet another backslash in string.find


It works as long as I start it from the current directory :

./widgets.lua
or
../bin/Windows/murgaLua.exe widgets.lua

(And it is pretty awesome (!!!))

If I do :

../bin/Windows/murgaLua.exe widgets_demo-alpha1/widgets.lua
or
./widgets_demo-alpha1/widgets.lua

It doesn't work.

Cheers
JohnM


RE: [WIP] MurgaLua Reference Tool - a little help? - mikshaw - 08-21-2007 05:52 PM

Thanks for that test. I guess I'll need to hit that again. I'm going to get the latest version onto a Windows machine sometime in the next couple of days so I can bang it around to see what breaks.


RE: [WIP] MurgaLua Reference Tool - a little help? - mikshaw - 08-25-2007 10:00 AM

I don't have a real reason to post this except to break the 2+ day lull here.

Additional widgets since Alpha 1 include:
system fonts (Fl:set_fonts)
curve drawing
freehand drawing (very limited)
Fl_Secret_Input
Fl_Scroll (John's example that I forgot to enable last time)
Fl_Progress
Fl_PNG_Image
Fl_PNM_Image
label symbols
cursors
fl_dir_chooser
Fl_Window

I made some pathname changes that I overlooked which should prevent problems in Windows, but I haven't tested it yet.
Also on Windows I need to test and work on the demo_appdir variable code

I'm running into more and more functions and widgets that are crashing, or just not doing anything. They are mostly FLTK things that are not implemented in murgaLua, but some are questionable. Some functions give me the impression that they are part of murgaLua but i just am not using them properly. I think I'm running out of quantity (apart from the more complex drawing functions that I'm afraid of) so I should start thinking more about quality.


RE: [WIP] MurgaLua Reference Tool - a little help? - mikshaw - 09-12-2007 04:48 AM

It's been nearly a month since the last upload, so I've released Alpha 2
From the changelog:

Quote:
* Alpha 2 released
* Removed dropdown menu from align.lua
* A few minor changes for easier keyboard control
* Added notes for various widgets
* Fixed some filename path issues for Windows
* Added some image manipulation to image widgets
* Added examples:
system fonts
curve drawing
freehand drawing
line drawing
secret input
scroll
progress bar
PNG image
PNM image
label symbols
cursors
fl_dir_chooser
window
radio buttons
tooltips


A few examples are broken or incomplete. I just wanted to take a break from those particular issues for a while.
There are still minor problems with the main script that need to be fixed before a beta release is made.

From this point on, the first post in the this thread will have a link to the most recent version


RE: [WIP] MurgaLua Reference Tool - a little help? - iGame3D - 12-11-2007 12:17 PM

Checking this out again, figured I'd bump the thread.

widgets_demo-alpha2.tar.gz


RE: [WIP] MurgaLua Reference Tool - a little help? - mikshaw - 12-12-2007 02:35 PM

I've made a few improvements, but I don't want to do much more until I get a chance to fully test it on Windows. I have fairly convenient access to a Windows XP machine, but honestly have been too lazy to go there and take the time to run the tests.
Just wanted to let you know that this isn't a dead project, but it probably won't pick up speed until after I upgrade my Slackware and DSL systems, reorganize the study, gather some more deadwood to keep me warm through the next few months, hack together the three old puters I have in the closet into one halfway decent box, fix some holes in the walls, yadda, yadda, yadda...

I'm guessing probably after christmas before a beta is ready.


RE: [WIP] MurgaLua Reference Tool - a little help? - JohnMurga - 12-12-2007 10:20 PM

mikshaw Wrote:
I've made a few improvements, but I don't want to do much more until I get a chance to fully test it on Windows. I have fairly convenient access to a Windows XP machine, but honestly have been too lazy to go there and take the time to run the tests.


I tested it in Windows and don't remember finding any major issues, either way it is something I'd really like to include in a future release (in some form).

Oh, and murgaLua isn't dead either, I just don't get much time to work on it right now ...
Although I am hoping Christmas will help with that :-)

Cheers
JohnM


RE: [WIP] MurgaLua Reference Tool - a little help? - mikshaw - 12-13-2007 01:44 AM

Quote:
I tested it in Windows and don't remember finding any major issues

There is apparently an issue in Windows with the path to the script. I've been told that it can't be run from just any arbitrary location. It must be run from within the program directory, which is not my idea of good design. This is my main concern for Windows at the moment, but I do want to thoroughly go through everything.
There is also the matter of a few half-completed and half-broken scripts that I will either remove or try to fix, but I'm undecided.

Quote:
it is something I'd really like to include in a future release (in some form)

I would assume "in some form" is the key phrase. This package is much larger than I ever expected it to be, mainly because I hadn't originally planned to include images or documentation. I'm not sure it would be appropriate to "include" it as-is with murgaLua, since it would cause a sharp growth spurt to the ML download size.


RE: [WIP] MurgaLua Reference Tool - a little help? - Juergen - 12-14-2007 01:10 AM

mikshaw Wrote:
There is apparently an issue in Windows with the path to the script. I've been told that it can't be run from just any arbitrary location. It must be run from within the program directory, which is not my idea of good design. This is my main concern for Windows at the moment, but I do want to thoroughly go through everything.
There is also the matter of a few half-completed and half-broken scripts that I will either remove or try to fix, but I'm undecided.


Isn't this something you already fixed for alpha2? I tried it today with alpha2 and it works (at least for me).

mikshaw Wrote:

JohnMurga Wrote:
it is something I'd really like to include in a future release (in some form)

I would assume "in some form" is the key phrase. This package is much larger than I ever expected it to be, mainly because I hadn't originally planned to include images or documentation. I'm not sure it would be appropriate to "include" it as-is with murgaLua, since it would cause a sharp growth spurt to the ML download size.


As long as John has no bandwidth problem with his page, I don't think that a few 100kB matter. If that is really an issue, it would make more sense to break up the current murgaLua package in source and binary packages.

Juergen


RE: [WIP] MurgaLua Reference Tool - a little help? - mikshaw - 12-14-2007 07:54 AM

Quote:
Isn't this something you already fixed for alpha2? I tried it today with alpha2 and it works (at least for me).

Maybe, but to be honest I can't recall exactly what that particular fix was. The last time I used this on Windows was only very briefly, so I mainly want to take more time to definitely make sure it works the same on both systems (i have no access to OSX).

Quote:
If that is really an issue, it would make more sense to break up the current murgaLua package in source and binary packages.

I suppose it could also be broken down further into source and separate binaries for the supported operating systems, as is typical of most other software projects.


RE: [WIP] MurgaLua Reference Tool - a little help? - jpjacobs - 12-15-2007 04:32 AM

hi!
i found a rather bizar bug: in the draw-freehand example, if viewing the code, and then dragging the mouse results in a segfault (on linux).
It's the same with the draw-freehand-lines , if you don't hit stop before.
I guess it's something to do with not stopping the drawing function before.

greetz,
JP


RE: [WIP] MurgaLua Reference Tool - a little help? - mikshaw - 12-16-2007 03:10 AM

Ok, I see that too. Thanks for the report.
I think the widget is just being hidden, rather than removed, when notes are shown. That would mean the loop is still running and trying to make active a non-visible widget.
This will definitely have to be top priority.

BTW, draw-freehand-lines is one of those incomplete widgets that might end up being removed. It is essentially the same as draw-freehand anyway.

EDIT: It was a pretty easy fix. I separated the widget replace function into two parts: remove and replace. The remove function is now called from the text load function, so there shouldn't be anything running in the background when you view source. This change will appear in beta1. I can't say at this time if it might have created a new bug...will have to do more testing.


RE: [WIP] MurgaLua Reference Tool - a little help? - mikshaw - 01-01-2008 01:13 AM

News: My hard drive is broken. I have no idea how long before I replace it, and then have no idea how much of its data can be salvaged. If I have to go back and pick up from the alpha stage again I will probably be kinda pissed and not want to do anything with it for a while.

With those three factors, I can't say with any level of certainty whether there will be an update soon (at least not until next year [giggle])


RE: [WIP] MurgaLua Reference Tool - a little help? - mikshaw - 01-07-2008 02:42 PM

More news: I installed a new drive today, but it will still be a little while before I get back to dev. I wanted to install a newer version of Slackware on the new drive, but today realized that it no longer installs a graphical system with only one CD, so it will take a little while to get the rest of the installation disks.

After that works out, I still don't know if I'll be able to save the latest files from the old drive, so I might find myself repeating old changes.


RE: [WIP] MurgaLua Reference Tool - a little help? - JohnMurga - 01-07-2008 11:42 PM

mikshaw Wrote:
More news: I installed a new drive today, but it will still be a little while before I get back to dev. I wanted to install a newer version of Slackware on the new drive, but today realized that it no longer installs a graphical system with only one CD, so it will take a little while to get the rest of the installation disks.

After that works out, I still don't know if I'll be able to save the latest files from the old drive, so I might find myself repeating old changes.


Hey

I am very sad to hear all this, I am going to try and release version 0.6 this week
before you get things set up ... As most of the fixes affect FLTK and may help what
you are doing.

I am also sure you'll be happy to know the executable size has decreased a bit :-)

I have been pretty useless on the DEV front lately as work and my better half take
up almost all my time right now ...

However, a test version (0.6.5), will be out very soon too, and that IS bigger :-(

Cheers
JohnM


RE: [WIP] MurgaLua Reference Tool - a little help? - mikshaw - 01-08-2008 03:57 AM

That's very good news. I'm happy you are continuing to develop this project regardless of the amount of time you get to work with it.

I installed DamnSmall Linux this morning from an older disk I had (last several releases have been direct install from the ISO rather than burning to disk), so I'm satisfied to use that exclusively until I get the rest of the Slackware setup. I like Grub (DSL's bootloader) better than lilo (Slack's bootloader) anyway, so having it already installed to use with Slack takes a little stress off me.

I might attempt to read my faulty drive later today, but the idea is still making me kind of nervous =o)


RE: [WIP] MurgaLua Reference Tool - a little help? - mikshaw - 01-08-2008 12:52 PM

Update: I was able to save all my important data from the flaky drive. It seems that it was having lots of trouble writing, but not much trouble reading. I don't recall ever seeing that before, but I'm grateful for it.

Expect a beta within the next week or so.


RE: [WIP] MurgaLua Reference Tool - a little help? - iGame3D - 01-08-2008 09:26 PM

I think i fixed the exiting or hiding on switching Widgets

Code:
function demo_replace_widget(new_file)
   -- remove previous widget
  if demo_widget then
  demo_widget:hide() -- hide it before removal
    demo_w:remove(demo_widget)
    Fl:delete_widget(demo_widget)
    demo_widget=nil
  end
  -- new child window for new widget
  demo_widget = fltk:Fl_Double_Window(0,demo_bh,demo_ww,demo_wh-demo_bh,demo_widget_files[i])
  dofile(new_file)
  fltk:Fl_End() -- end for each widget window
   demo_w:add(demo_widget)
   demo_widget:show()
   demo_w:redraw();
   demo_widget:make_current() -- needed for drawing functions
end


All I needed was one good sleepless night to allow me to have
more sleepless nights hacking this thing to do my bidding!


RE: [WIP] MurgaLua Reference Tool - a little help? - mikshaw - 01-09-2008 12:38 AM

I'd already broken up this function into two parts in order to fix a crash mentioned earlier, so depending on what changes you've made (is it simply hiding the widget?) it may need a little more work. This is its current state, plus the hide line, though it hasn't been tested:

Code:
function demo_remove_widget()
  if demo_widget then
    demo_widget:hide() -- hide it before removal
    -- remove previous widget
    demo_w:remove(demo_widget)
    Fl:delete_widget(demo_widget)
    demo_widget=nil
  end
end

function demo_replace_widget(new_file)
  demo_remove_widget()
  -- new child window for new widget
demo_widget=fltk:Fl_Double_Window(0,demo_bh,demo_ww,demo_wh-demo_bh,demo_widget_files[i])
  dofile(new_file)
  fltk:Fl_End(demo_widget) -- end for each widget window
  demo_w:add(demo_widget)
  demo_widget:show()
  demo_widget:make_current() -- needed for drawing functions
end




RE: [WIP] MurgaLua Reference Tool - a little help? - iGame3D - 01-09-2008 09:43 AM

yep that works!
Its just a case of hide before remove.
I've done some hacking with this, I'm using a separate window for the script.
Is there a way to pass that text to the clipboard very fast?
I can then leave the scripts hidden and just paste this magic stuff where needed.


RE: [WIP] MurgaLua Reference Tool - a little help? - mikshaw - 01-09-2008 02:55 PM

Quote:
Is there a way to pass that text to the clipboard very fast?

I don't understand what text you mean, or what clipboard. It might be a OS specific thing? As the script is now, I believe you can save the text in the editing window to a file, but I haven't done any advanced Text_Editor features, even as simple as copy.


RE: [WIP] MurgaLua Reference Tool - a little help? - iGame3D - 01-09-2008 09:40 PM

I mean so that its available to the system globally to paste.

Anyway...get the version out. This things handy but stuff
is missing, like event enumerations.

I have a bare naked source forge project if you want to create and SVN space for your mad science. Let me know.


RE: [WIP] MurgaLua Reference Tool - a little help? - mikshaw - 01-10-2008 02:22 AM

Quote:
I mean so that its available to the system globally to paste.

I'm sorry, but I still don't understand. To what "text" are you referring? Is it the widget source code, the notes, both? Something else? I haven't done any work yet with copy/paste other than a test of drag and drop of a file onto a murgaLua interface in order to retrieve the filename of the dragged file, and that took hours to work out and its reliability seems to be dependent on your desktop environment. No idea yet about exporting from murgaLua to external applications, but that will hopefully come eventually.

Quote:
Anyway...get the version out. This things handy but stuff
is missing, like event enumerations.

I'm going to be making minor tweaks over the next several days, and plan to spend a few hours testing it thoroughly in Windows, and then it will be considered a first beta. There are no plans for more additional functions or widgets until after that time (there are a few additions already that are not in the alpha). Please keep in mind that this project is being developed as I learn more about murgaLua, which is why there are things missing (still lots to learn), and is the reason I initially asked for help so I wouldn't need to do all my learning by poking at things.

Quote:
I have a bare naked source forge project if you want to create and SVN space for your mad science.

That sounds like a good idea, thanks. I have no clue how SVN or similar systems work, so I'll need to do some research. Basically I just work on a single directory structure and periodically zip up an archive when it reaches a satisfactory state.


RE: [WIP] MurgaLua Reference Tool - a little help? - iGame3D - 01-10-2008 06:34 AM

I mean to copy the widget script text as if selecting it and copying, only without the manual select.

Send your source forge account name to bill at igame3d dot com.
Ill add you as an admin on the iGame3D lua project and you
can learn to make and break SVN at the sourceforge site.

Basically you'll want to set up a trunk under a user name or project
name like "WidgetsDemo" Or "MikMurgaWidgets", etc.

Its been awhile since we set up the main igame3d trunk,
I think getting encryption keys was the weirdest part.


RE: [WIP] MurgaLua Reference Tool - a little help? - mikshaw - 01-11-2008 01:15 AM

Message sent, and reply recieved. Thank you.

Quote:
I mean to copy the widget script text as if selecting it and copying, only without the manual select.

I assume that's doable. The text is accessible as a single unit in either demo_display_buffer or demo_editor_buffer, so I suppose that could be easily added to a clipboard. For the beta I've already added limited support for using an external editor to view the source code, so I imagine a similar principle could be used to send that data elsewhere. Now that I think of it, the external editor was one of the main things that I hadn't yet checked in Windows.


RE: [WIP] MurgaLua Reference Tool - mikshaw - 01-23-2008 01:38 PM

I never did get around to testing it in Windows, but I still uploaded beta 1 for scrutiny.

From the changelog:

Quote:
* Fixed draw loop segfault when viewing notes
* Added some features to Fl_File_Browser
* Added support for external code viewer
* Fixed the labeltypes widget (requires murgaLua 0.6+)
* Fixed boxtypes to display properly in both 0.5 and 0.6
* Removed some old/broken scripts
* Added examples:
Fl_File_Icon (added to main script)
positioner
box types
marquee
embedded XPM (murgaLua 0.6+)
draggable box
gravity tests




RE: [WIP] MurgaLua Reference Tool - JohnMurga - 01-24-2008 07:10 PM

Amazing ... Please can I include it in the full distribution ?

I'll test it thoroughly in Windows for you :-)

The examples are superb, and would help anyone trying to get to grips with things.

Cheers
JohnM


RE: [WIP] MurgaLua Reference Tool - mikshaw - 01-25-2008 12:22 AM

Of course you "can" =o)

I just wonder if you should, considering the added size (although if it's kept zipped i suppose it's not so bad) and the fact that it's still beta. There are at least some minor annoyances that I would like to deal with, but it does clearly state that it's a beta, so buyer beware i suppose.

But I'm not going to dictate, or even try to influence your decision.

Know that the menu system is still the old clumsy method, because it is designed to support 0.5
If you intend to keep this tool with future murgaLua distributions, I will probably rewrite the menu.


RE: [WIP] MurgaLua Reference Tool - mikshaw - 01-26-2008 07:01 AM

Another issue that didn't occur to me until just now,
Some of the demos utilize variables from the main script, such as demo_bh and demo_widget.
These demos may not perform properly, or at all, when previewed from the edit window, because the preview function runs the script in a new process separate from the main script.

I'll have to work out whether to remove those variables from the demos, or export them before running the preview.


RE: [WIP] MurgaLua Reference Tool - iGame3D - 01-26-2008 09:06 PM

The button in the upper right corner of the window gives this message when pressed:

Code:
sh: line 1: aterm: command not found


All else seems to work.
Gravity3 demo is such a zombie attack.

Awesome work.


RE: [WIP] MurgaLua Reference Tool - mikshaw - 01-27-2008 12:21 AM

sh: line 1: aterm: command not found

This is something I completely forgot about, and was one of the things needing to be tested in Windows.
Change the "external_viewer" variable to the text editor of your choice.


RE: [WIP] MurgaLua Reference Tool - iGame3D - 01-27-2008 05:45 AM

mikshaw Wrote:
Change the "external_viewer" variable to the text editor of your choice.


Sweeeeeeeet.
This thing gets better every minute.


RE: [WIP] MurgaLua Reference Tool - mikshaw - 02-02-2008 06:49 AM

Beta 2 is now available. This version doesn't have many changes, but I particularly wanted to fix that edit preview problem as soon as possible. It now uses a separate instance of murgaLua (using murgaLua_ExePath), and includes the global variables that are used in some of the widget demos. This of course won't work in murgaLua prior to 0.6, but with an earlier version the user can still export script changes and/or edit in the external editor. By the time the beta stage has passed I'll have rewritten the menu system anyway, so support for 0.5.5 will have to be dropped.


RE: [WIP] MurgaLua Reference Tool - iGame3D - 02-02-2008 07:52 AM

I knew I should have posted my changes as I went along.
Everytime I edit this thing, you come out with a new version.

In order for the compiled and/or script version to run equally
I changed the code last night to this

Code:
-- set directory separator according to operating system
if murgaLua.getHostOsName() == "windows" then demo_sep="\\" else demo_sep="/" end

arg={}
--default to current directory, works after cd in scripting, not in standalone
CurDir = lfs.currentdir().."/"

-- find murgalua folder, or the script as compiled binary
pathToMurgaLua = string.gsub(murgaLua_ExePath,"(.*)/.*","%1").."/"

-- test for presence of demo scripts folder
if lfs.attributes(pathToMurgaLua.."script") ~= nil then CurDir = pathToMurgaLua end

-- in script mode the argument is received when executing this script
if arg[0] ~= nil then CurDir = arg[0] end  

-- Get the dirname and basename of the current script or binary
if string.find(CurDir,demo_sep) then
  demo_appdir=string.gsub(CurDir,"(.*)"..demo_sep..".*","%1") -- data directory
  demo_title=string.gsub(CurDir,".*"..demo_sep.."(.*)","%1")
else
  demo_appdir="."
  demo_title=CurDir
end


arg throws an error in the compiled version unless it gets some data.
My changes manage to kill this bug.

Code:
/bin/murgaLua/examples/widgets: [string "--#!/bin/murgaLua..."]:236: attempt to index global 'arg' (a nil value)
stack traceback:
        [string "--#!/bin/murgaLua..."]:236: in function 'newFunc'
        [string "murgaLua"]:268: in function 'decompileMurgaLua'
        [string ""]:1: in main chunk
        [C]: ?


Also have to comment out "#!/bin/murgaLua" in the first line for compile.
It will throw a false error at line 268 for some reason.

I just made the code changes and recompiled it works on my side at least.
See what happens over there.


RE: [WIP] MurgaLua Reference Tool - mikshaw - 02-02-2008 08:37 AM

I'll make this permanent in the future. Thanks.

Quote:
Also have to comment out "#!/bin/murgaLua" in the first line for compile

I couldn't say why, unless maybe the interpreter is checked against murgaLua_ExePath or something?
I'm going to continue using it in the releases, though (should be easy enough to remove before compiling). It's just my preference to make scripts executable and run them directly, and is common practice in Unix/Linux. Using a script as an argument to an interpreter is an unnecessary pain in my butt.


RE: [WIP] MurgaLua Reference Tool - mikshaw - 02-02-2008 09:21 AM

It looks like it needs more work to be used in both script and binary format. The arg={} line breaks the script...arg[0] no longer works after that, and therefore all paths are searched for in the current directory. That's definitely NOT acceptable...I need it to find the proper demo_appdir no matter what the current directory is, and I'm not going to force a change of directory in order to do this. Also, if arg[0] doesn't work in the binary there are at least two other places it needs fixing, in demo_menu_callback() and demo_show_readme().


RE: [WIP] MurgaLua Reference Tool - iGame3D - 02-02-2008 11:27 AM

mikshaw Wrote:
Also, if arg[0] doesn't work in the binary there are at least two other places it needs fixing, in demo_menu_callback() and demo_show_readme().


Yep the read me and "Show main script code" breaks with the change of arg.

arg breaks the script when trying it from a dofile()

I could send the binary an argument, but the argument
is based on the script, which isn't needed once the binary is built.
Lets see what that does.


RE: [WIP] MurgaLua Reference Tool - mikshaw - 02-02-2008 01:15 PM

I don't understand why the arg table doesn't work in the binary, since it's standard Lua. Perhaps there is a problem with the compiler.

Quote:
Before starting to run the script, lua collects all arguments in the command line in a global table called arg. The script name is stored at index 0, the first argument after the script name goes to index 1, and so on. Any arguments before the script name (that is, the interpreter name plus the options) go to negative indices. For instance, in the call

$ lua -la b.lua t1 t2

the interpreter first runs the file a.lua, then creates a table

arg = { [-2] = "lua", [-1] = "-la",
[0] = "b.lua",
[1] = "t1", [2] = "t2" }

and finally runs the file b.lua. The script is called with arg[1], arg[2], as arguments; it can also access these arguments with the vararg expression '...'.




RE: [WIP] MurgaLua Reference Tool - iGame3D - 02-02-2008 02:40 PM

The compiled version doesn't get any arguments since it doesn't require an external script, arg will be nil unless the binary itself is sent an argument.

Sending the binary an argument of the original script does the trick.
No need to change any of the code I mentioned earlier.
Except that first line.


RE: [WIP] MurgaLua Reference Tool - mikshaw - 02-02-2008 03:17 PM

I'm looking forward to seeing what you might find, but if there is no available pointer to the path of the executable I don't intend to support the binary version of this package. I'm not going to rely on the user being in the application directory.

EDIT: Okies, then. I spoke too soon. When you say "sending an argument" do you mean sending it when you compile, or the enduser sending an argument to the compiled package?


RE: [WIP] MurgaLua Reference Tool - iGame3D - 02-02-2008 06:03 PM

The Applescript script that launches the executable sends the argument.

Its an applescript bundle with the murgaLua compiled binary "widgets" in a directory thus:

widgets.app/Contents/MacOS/widgets

The content of your widget stuff, images, scripts, etc is thrown into
widgets.app/Contents/Resources/lua/

When the program bundle is double clicked it activates the following script,
which cd's to the bundle directory and launches the widgets binary with the
widgets.lua script acting as argument.

Code:
set murgaBinary to "Contents/MacOS/widgets"
set luascript to "Contents/Resources/lua/widgets.lua"
set bundlepath to path to me as string
-- cd and launch binary
set s to "cd '" & the POSIX path of bundlepath & "'; " & murgaBinary & " " & luascript
do shell script (s)


It could work with just a murgaLua executable instead of the compiled widgets binary,
which is how I ran it a long time ago, but this was a test of the compile process.

The benefit: no install, no authorization, no chmod, no command line
Just unzip + double click = widgets!


RE: [WIP] MurgaLua Reference Tool - mikshaw - 02-03-2008 01:26 AM

Sooo....

what do I need to do in order that it will not break when compiled, but so that I'm also satisfied with the behavior of the uncompiled script? Mainly the uncompiled script must be able to be run in any directory, from any directory, whether called as a command or as an argument to murgaLua.

Eventually I would like that to work even from a link/shortcut, but it's something I've never done in Lua, and I think it might be an OS-dependent issue.

By the way, how does viewing/editing of code work in this package if it's compiled?


RE: [WIP] MurgaLua Reference Tool - iGame3D - 02-03-2008 09:08 AM

Everything works fine in the binary, edit or view code, activating widgets, the works.

Finding the files from the binary on other systems is a mystery to me.
On Mac I'm keeping everything in a bundle and the Applescript solves the problem
of passing the right directory inside of that bundle to the binary.

dofile fails on arg[0]

There needs to be some test for arg, and if its nil then ...I'm not sure
how you'd find the script, does lua have any kind of "last file loaded"
global hanging around?

I thought I figured it out the other day but thats much less than a perfect solution.
I'm stumped, but happy its working well.


RE: [WIP] MurgaLua Reference Tool - JohnMurga - 02-03-2008 12:13 PM

I'll take a look at this tomorrow night ... Don't forget that the compiler is the first beta, so if there are issues (and there are), I just have to fix them :-)


RE: [WIP] MurgaLua Reference Tool - mikshaw - 02-05-2008 03:58 AM

I was playing around with Vector Linux last night, and bumped into an application called gtk-demo. This application is virtually identical in its purpose, but the design of its interface is quite different. Gtk-demo is cleaner and simpler in both behavior and code, and I'm seriously considering a redesign. It would make the code much smaller and easier to follow, less prone to bugs, and provide a more friendly experience to the enduser. In fact, I'm quite certain that this will be a smart move.

The interface of gtk-demo is split into two sections: a selection browser on the left, and two tabs on the right. The tabs are "Info" (same as my "notes"), and "Source". When a widget name is selected in the browser, that Lua file and its associated text are loaded into the tabs. Double-clicking the widget name displays the widget in a new window rather than a nested window (which has given me more than a few headaches). This simple UI change would remove the need to mess with changing titlebar names, toggling menu items, exporting variables, limiting widget dimensions, watching out for clobbering or missed variables, and a number of other issues that I've had to pay close attention to. Most importantly the code for the individual widgets will not need to be tailored specifically for use in this package...any MurgaLua script that works on its own can simply be dropped into the data directory as-is.

This design won't be fully implemented, though. I'd much rather just have a button to launch the demo rather than deal with testing for single or double clicks. But it amazes me when I think about how much simpler it will be to manage the code with this design, and will be less annoying to the user with fewer clicks to do.

So, it will be a little while before Beta 3 is released, but it will likely be smaller and less buggy.

It still won't account for the arg issue, though. I will still need to know exactly where the data files are.


RE: [WIP] MurgaLua Reference Tool - mikshaw - 02-06-2008 01:08 AM

Of course, there are some issues I hadn't realized.

* The images directory still needs to be found by some of the demos, so I needed to set that variable from the murgaLua commandline. I don't think there's any way around that short of embedding all images, which would limit the flexibility of demos.
* The progress widget needed to be incorporated into the main interface, but that wasn't a big problem.
* There are some cosmetic issues that need to be worked out...resizing and intrusive scrollbars in particular
* Some of the "features" in the previous version will probably be dropped, such as coloring and styling the interface. These will be included as demos. I'll probably still include font scaling for the sake of readability.
* I had to remove or replace some variable names in practically all of the demos, and resize most of the windows for visual appeal =op

Overall I like the way the new interface works. The main script is about half the size and much less complex. Code viewing and editing is now done in a single field. Demos are run and saved from whatever code is in that field, so it doesn't need to access the file more than once. Info files (for existing widgets) that are added while the application is running can be viewed without restarting (just a dev issue that was annoying me). I'm hoping to do something similar for the demo files themselves, but that will be a bit harder. Code and Info are loaded simultaneously, so accessing either is just a matter of clicking a tab rather than reloading one or the other. The Lua manual is now loaded (on demand, to save precious resources) in a tab rather than a separate window. Eventually it will be much easier to control via keyboard than the old menu system ever could be.

EDIT: the disappearing window was a stupid user error =o)


RE: [WIP] MurgaLua Reference Tool - mikshaw - 02-13-2008 04:14 AM

I briefly tested the new design in Windows, and one major part doesn't work yet.

Finding the murgaLua executable (for 0.5.5 support) works fine, so I was happy about that part:

Code:
for i in pairs(arg) do
if not low or i < low then low=i end
end
MURGALUA=arg[low]


But the command that is supposed to pass the images directory to the individual demos doesn't work:

Code:
io.popen(MURGALUA.." -e 'images=\""..images.."\"' "..tempfile)

It gives an error concerning an unexpected symbol. I'm thinking it's either the escapes or the nested quotes.

EDIT: Next time I'm going to try this to see if it's better:

Code:
io.popen(MURGALUA..[[ -e 'images="]]..images..[["' ]]..tempfile)




RE: [WIP] MurgaLua Reference Tool - mikshaw - 02-28-2008 11:25 AM

After some changes to that according to feedback from Juergen, I've made a change that will hopefully work in Windows, but it hasn't yet been tested. It does work in Linux, and I assume OSX as well, so I've posted beta 3 hoping that it can easily be fixed if it doesn't work in Windows.

http://www.murga-projects.com/forum/attachment.php?aid=35


RE: [WIP] MurgaLua Reference Tool - iGame3D - 02-28-2008 12:37 PM

Awesome!
Works great!
I think those buttons at the base need to get moved though.
Whats the x%(n of nn) box in the corner?

Have we figured out how to display styled text?
Syntax styling on those scripts would be fantastic.
I suppose displaying html like the lua manual does the trick.

If its not already in your documentation, notes, and scripts,
you may want to begin adding a version number.

It will be useful to see whats new, and maybe see if something
has been removed before the current version of murgaLua, and
provide a pointer to the new style of doing things.
The file and timer stuff comes to mind.

Another thing might be to run "Snippets" as a separate but
nearly identical program with an "add" button.
Looks like it could be a handy tool, I have such a program,
but its not handy for murgaLua.

Why are you worried about 0.5.5 compatibility?

1.0 will compare to 0.5.5 as 0.5.5 compares
to John linking Lua and Fltk together for the first time.

Push forward.

Next step an IDE with compiler and GUI editor, yeah?
You have the makings for it right here in this reference gizmo!

I've been meaning to post a thread to get that started, but
seriously had to wait and see what you would pull off here.
Now to figure it all out.

Bravo!


RE: [WIP] MurgaLua Reference Tool - mikshaw - 02-28-2008 07:10 PM

Quote:
I think those buttons at the base need to get moved though.

I had them originally at the top, but it seemed bulky-looking. Being a keyboard-focused user, I sometimes have trouble balancing the visual with the easily-clickable. I'm open to any suggestions you have.

Quote:
Whats the x%(n of nn) box in the corner?

It's an example of Fl_Progress(), displaying the number of demo scripts that have been viewed. It was originally a separate widget, but the design change made it necessarily part of the main script. I was thinking about moving into a tab, but the main screen was visually unbalanced without it.
Is it literally displaying "x%(n of nn)"? That would not be good.

Quote:
Have we figured out how to display styled text?
Syntax styling on those scripts would be fantastic.
I suppose displaying html like the lua manual does the trick.

I started to mess with formatting the snippets page with html, but after twenty minutes I realized that it will be a pain to make updates to it. Syntax highlighting is definitely on my want-to-do list, but every time I look through the Fl_Text_Editor docs I start to get dizzy =o)

Quote:
If its not already in your documentation, notes, and scripts,
you may want to begin adding a version number.

It's there, at the top of the readme. My versioning system is very basic. Each release in incremented by 1 unless a very tiny yet very vital fix is needed.

Quote:
It will be useful to see whats new, and maybe see if something
has been removed before the current version of murgaLua, and
provide a pointer to the new style of doing things.
The file and timer stuff comes to mind.
Another thing might be to run "Snippets" as a separate but
nearly identical program with an "add" button.

I like those ideas. The Changelog is there, but it is not accessible through the gui and isn't terribly explicit. User-added snippets is brilliant, although it is not likely to be implemented right away.

Quote:
Why are you worried about 0.5.5 compatibility?

I care about backward compatibility in general, as long as it is reasonable to do so. Version 0.5.5 was a pretty big change, so support for prior versions would be more work than it's worth. When it gets to the point where 0.5.5 support is an annoyance I'll likely drop it. Until then, support for it has been only a tiny issue. Also, I am positive that 0.5.5 is still circulating on fairly recent live CDs, so it's still in use (I still have a DSL system with version 0.5.5 installed on 2 machines). Finally, I believe intentionally including code to support older versions is an educational example in itself.

Quote:
1.0 will compare to 0.5.5 as 0.5.5 compares
to John linking Lua and Fltk together for the first time.

I'm also pretty sure 1.0 is still quite a while away. This demo package will evolve as time goes on, and will eventually also reach a 1.0 stage and be quite different than when I started.

Quote:
Next step an IDE with compiler and GUI editor, yeah?

Several times I have thought about the possibility of doing something in murgaLua based on the behavior of fluid but with a vtcl philosophy; in other words, a tool written in murgaLua that generates pure murgaLua code. However, thinking about the possibility is as far as I've ever gotten. That would be a big project and I'm not sure I'm the one to start it at this time.


RE: [WIP] MurgaLua Reference Tool - JohnMurga - 02-28-2008 09:17 PM

Hey

AWESOME ...

but

Doesn't work on Windows ... You get a :

Code:
(command line):1: unfinished string near '<eof>'


This is because the final "\" in the images path escapes the quotes in the DOS command ...

To fix modify the code as follows (or something similar, as I just knocked this up quickly)

Code:
if (string.find(images, "\\$") == string.len(images)) then
    images=string.sub(images, 1, string.len(images)-1)
  end
  io.popen(MURGALUA..[[ -e "images=']]..images..[['" ]]..tempfile)


Cheers
John de Murga


RE: [WIP] MurgaLua Reference Tool - JohnMurga - 02-28-2008 09:29 PM

Ooops ...

Nope, that doesn't really work as the "\" is being escaped somewhere else ...

The simplest thing to do is replace all the "\" with "/" as they both work when opening files / etc ...

Code:
images = string.gsub(images, "\\", "/")
  io.popen(MURGALUA..[[ -e "images=']]..images..[['" ]]..tempfile)


This makes it work right now, but personally I would change the "sep" logic and only use "\" where you REALLY need it.

I am happy to go in and do that.

Cheers
JohnM


RE: [WIP] MurgaLua Reference Tool - mikshaw - 02-29-2008 01:38 AM

Quote:
The simplest thing to do is replace all the "\" with "/" as they both work when opening files / etc
This makes it work right now, but personally I would change the "sep" logic and only use "\" where you REALLY need it.

0_0

I don't understand.....does Lua automatically convert the slash to a backslash in Windows?
And if so, in what situations would you still need the backslash?

You'd think this seemingly well-known issue would be mentioned in the Lua docs.


RE: [WIP] MurgaLua Reference Tool - mikshaw - 03-02-2008 12:03 PM

I've been looking at this unplugged old machine (400mhz if memory serves me) at my feet for the last couple of weeks. It technically belongs to someone else and I had originally installed Vector Linux on it for him (hoping to spread the linux virus), but knowing him I have serious doubts that he will ever bother to pick it up. So now I'm starting to think about sticking windows 98 or 2000 on it to use purely as a testing platform for murgalua.

Since that possibility has arisen, does anyone know if it's possible to emulate OSX in Windows on a machine that old? Maybe I can have the full spectrum of murga-supported platforms on which to test.


RE: [WIP] MurgaLua Reference Tool - JohnMurga - 03-02-2008 10:52 PM

Sorry, but ...

The process is illegal as it would involve getting hold of a copy of OSX which no possible unless you own a Mac. Secondly to do so would require SSE2 emulation, which (as far as I know), is only possible with VmWare on a SSE2 host machine.

But the Mac port is very similar to Linux one, the big issues are Linux/Mac -> Windows.

Cheers
JohnM


RE: [WIP] MurgaLua Reference Tool - iGame3D - 03-03-2008 07:41 AM

mikshaw Wrote:
windows 98 or 2000 on it to use purely as a testing platform for murgalua.

does anyone know if it's possible to emulate OSX in Windows on a machine that old?


You could emulate MacOS 9.
Wanna try murgaLua without a command line?

I have been thinking about this all month.
Well ok since I found the forum, I said "wow mikshaw is a genius, maybe he can help with iGame3D!", and then read "linux" :-(
Then I seriously consider linux port, but have never even seen linux running in person.

If you are in the states, I could send you a 600Mhz Win XP laptop and a OS X 10.4 900Mhz iBook. The iBook however is still PPC, Tobi is still on PPC as well and my Daughter has a PPC mac mini. Which means we have to support that for at least another year or two. I think between us we can figure out how to get
murgaLua lipo'd for PPC and test the results.

The iBook is certainly fast enough for you to test some widgets in and say "neat!".

What do you think?


RE: [WIP] MurgaLua Reference Tool - mikshaw - 03-03-2008 08:27 AM

I got the old pc loaded with Win2000 and messed around with the quotes problem until it seems to work in both Windows and Linux (I assume OSX will have no trouble with it).
The solution was to use single quotes to concatenate the shell command in the main script, use double quotes for the -e string (windows shell requirement, apparently), and double brackets to enclose the directory path so it will just be seen by the shell as part of the -e string:

Code:
io.popen(MURGALUA..' -e "images=[['..images..']]" '..tempfile)


So I made a beta 3b release with only that change and a couple of minor additions. There's a new image/animation test, and a "What's New" page. After clicking around a bit, I think you're right that the interface still needs improvement.
http://www.murga-projects.com/forum/attachment.php?aid=38

Quote:
If you are in the states, I could send you a 600Mhz Win XP laptop and a OS X 10.4 900Mhz iBook.

There's no way I could turn that down! I've bugged/begged some people I know to spead the word around that I'm willing to take old machines off their hands to refurbish and give away, or just to use as parts or testing machines, but since I live in the sticks there aren't many people who even have old computers.

I have seen OSX from a secondhand view, but never actually had an opportunity to use it. I've also not seen how iGame3D is built (I assume it's not pure lua), so it's likely that I wouldn't be able to do much in the way of coding. But I am (or technically *was*) a professional artist and animator, so I'm not limited to just testing and scripting.

Keep in mind, though, that if I got my hands on an XP laptop it would probably become at least a dual-boot machine pretty fast =o)

Quote:
You could emulate MacOS 9.
Wanna try murgaLua without a command line?

I thought murgaLua wouldn't run on OS9?


RE: [WIP] MurgaLua Reference Tool - iGame3D - 03-03-2008 09:59 AM

mikshaw Wrote:
I have seen OSX from a secondhand view, but never actually had an opportunity to use it.  

Oh you will like it.

mikshaw Wrote:
I've also not seen how iGame3D is built (I assume it's not pure lua), so it's likely that I wouldn't be able to do much in the way of coding.

Plenty to do in the way of murgaLua, keeping this reference compatible with iGame3D, and modding it for iGame3D reference...just for starters.

mikshaw Wrote:
But I am (or technically *was*) a professional artist and animator, so I'm not limited to just testing and scripting.

Ha no kidding, I totally took you for a systems admin somewhere.

mikshaw Wrote:
Keep in mind, though, that if I got my hands on an XP laptop it would probably become at least a dual-boot machine pretty fast =o)

Heh, this machine dual boots English/Chinese right now.

Quote:
I thought murgaLua wouldn't run on OS9?

  
I was joking. Tongue

Send an address to

bill at igame3d dot com

and I'll box these up.


RE: [WIP] MurgaLua Reference Tool - mikshaw - 03-04-2008 07:08 AM

Thank you! I'm looking forward to seeing OSX in action...and to the ability to code and watch TV at the same time =o)

As stated in the "windows problems" thread, the potato drop demo won't work as-is in Windows. That will be fixed in the next release.


RE: [WIP] MurgaLua Reference Tool - jpjacobs - 03-06-2008 12:05 AM

there are maybe some things that could bee included in the options tab like:
* external viewer
* theme
* maybe keybindings (or at least a list)
Just some thoughts Smile

Jan-Pieter


RE: [WIP] MurgaLua Reference Tool - mikshaw - 03-06-2008 03:25 AM

Thanks for the feedback.

Quote:
* external viewer

This was included in the previous layout. I haven't incorporated it into this one yet mainly because I'm not sure how I'd handle running demos edited with the external editor. The demos now run as a separate process, so I'd need some way to keep track of the file that's being edited externally.

Quote:
* theme

That was put back in yesterday =o)

Quote:
* maybe keybindings (or at least a list)

It can be fully controlled with a keyboard now, but I need to do some work on it. I want to make sure that all hotkeys are global so you don't need to switch to the info tab first in order to view the readme, or to the docs tab to load one of the document pages. It should automatically switch to the appropriate tab when you press the key combo.

The idea of user-configured hotkeys had crossed my mind, but I don't have any definite plan to do that.

The next version will also include separate categories within the file list, which can be collapsed and expanded individually. I was really excited to be able to get that working, although it still needs some streamlining.


RE: [WIP] MurgaLua Reference Tool - mikshaw - 03-06-2008 03:47 AM

Quote:
(very old post) I was thinking, perhaps you want to have a means of exporting the samples and comments to a indexed HTML page(s) for posting to the web. Just a thought.

The more I think about this idea, the more I like it. I think it's going in the todo pile.

It may not be a part of the demo interface itself, but maybe a separate Lua script that will convert the contents of the scripts directory to simple html. I'm still not liking the idea of frames, so it would probably be CSS layout for browsers that support it, and similar to the typical Linux online HowTos for those that don't.

I suppose when I get better with using fl_read_image and saveAsPng I could possibly use those to dynamically create screenshots to include with the html


RE: [WIP] MurgaLua Reference Tool - mikshaw - 03-30-2008 06:14 AM

The external editor has been put back in. It requires the user to either edit the main script or set a variable on the commandline (murgaLua -e "ext_editor=[[something]]" widgets.lua) The added button will load the existing buffer into an external editor, via temp file, and when you close the editor the temp file will be reloaded into the buffer. It was very easy to incorporate it this way, rather than have the external editor be an alternative to the Fl_Text_Editor. I haven't got a clue how I'd do it that way, and don't really want to think about it.

Still want to do some more menu bar work, and maybe one or two small toys. Then I need to bring it back into Windows for a quick test (was pretty thorough with it yesterday).
Beta 4 to come soon.

The more gets added to it, the more it's becoming a general reference tool rather than mainly FLTK widgets. I'm thinking a name change is imminent


RE: [WIP] MurgaLua Reference Tool - boscobearbank - 03-30-2008 07:33 AM

Hi mikshaw,

I'll be the first to admit I don't know what I'm doing (and I hereby so admit). Be that as it may, I have a question regarding the clock demo in beta3. I ran the demo with the "show demo" button and it worked fine. However, when I saved the file (along with a copy of the images directory) to my home directory and ran the program, I got the following error:

/usr/local/bin/murgaLua: clocks.lua:20: attempt to concatenate global 'images' (a nil value)
stack traceback:
clocks.lua:20: in main chunk
[C]: ?

so I inserted the line:

images = "images/"

above line 20 in the program and all was well. I guess I was just wondering if the individual demo programs are designed to be totally free-standing or if they deliberately use external global variables?

--
Bosco Bearbank


RE: [WIP] MurgaLua Reference Tool - mikshaw - 03-30-2008 08:35 AM

Most of them will work fine as-is, but those that use the images directory need the directory added to them (there are 7 or 8 of them, I think).

The old version of the demos package had all of the demos load as part of the main script. While this made some things more convenient, it caused porblems in other areas. The way it is now, any script that can run on its own can be dropped into the script directory without change. The only ones that need a helping hand are the ones that rely on external images.

In order to make the package as portable as possible, specifically so you can put it anywhere you want and not have to be *in* that directory when you run it, the images variable is dynamically set when the main script is run. When you run a demo, the code buffer is copied to a temp file (in order to use any changes you make) and that is run instead of the original script. Here's where the main problem came in...that temp file is no longer in the script directory, so it doesn't know where the images directory is. The main script passes the images variable to the temp demo. When you save the file and run it independently, the variable is not passed to it.

I *could* have saved the variable with every script, but that would be overkill since only a handful of the scripts actually use images.

I'm open to any suggestions for a better solution.


RE: [WIP] MurgaLua Reference Tool - mikshaw - 04-02-2008 07:40 AM

There seems to be a problem with uploads on the forum today, so I wasn't able to put beta4

Current changelog:

Quote:
2008-04-01:
* Dropped support for murgaLua below 0.6
* File list split into collapsible sections
* Returned the ability to set a global scheme
* Returned the external editor
* Made columns resizable
* Better keyboard control
* Code cleanup
* Name change from widgets demo to murgaLua demos
* Fixed "show demo" button to not collapse browser on click
* Fixed save button crash on main code (disabled the button)
* Fixed potato drop mouse click test for Windows
* Fixed xpm_file.xpm transparency in Windows
* Added examples:
button roll-over, FLU emulation
Flu_Choice_Group, FLU emulation
collapsible browser
LCD-style number display


I'll try uploading again later tonight.

April 7: still no luck.
Error message:

Quote:
The file upload failed. Please choose a valid file and try again. Error details: There was a problem moving the uploaded file to its destination.




RE: [WIP] MurgaLua Reference Tool - JohnMurga - 04-09-2008 08:14 AM

Weird problem ...

Permissions needed changing after the OS upgrade to the server (how weird!).

Anyway, here the the current you sent me ... I'll delete my post when you update.

Cheers
JohnM


RE: [WIP] MurgaLua Reference Tool - mikshaw - 11-10-2011 06:24 AM

I can't believe I let that sit for three years! The original post is now updated with a link to beta 4 =o)

I'm still playing with this here and there for a few minutes at a time, but I haven't done enough with it to justify packing up a new release.


RE: [WIP] MurgaLua Reference Tool - roydobbins - 12-10-2011 11:52 AM

mikshaw Wrote:
I can't believe I let that sit for three years! The original post is now updated with a link to beta 4 =o)

I'm still playing with this here and there for a few minutes at a time, but I haven't done enough with it to justify packing up a new release.


Mik:

please keep at it, i think MurgaLua, FLTK are very promising and my interest is in that they are antidotes to the bloatware

we had a conversation a while back on this forum, revolving around a screen issue i was seeing in a database application

what is vital here are your demos!!!

so i think it important that the reference guide eventually should cover some of the more tricky and subtle issues, and also serve as a template for how to implement stuff

--roy


RE: [WIP] MurgaLua Reference Tool - JohnMurga - 12-10-2011 11:25 PM

mikshaw, what OS are you using now ?

I PROMISE 0.7.5 for X-Mas :-)


RE: [WIP] MurgaLua Reference Tool - mikshaw - 12-11-2011 03:34 AM

Debian Wheezy. Can't recall having any issues since switching from DSL/TinyCore, although I might have needed to install a c library other than the default, but that's not an uncommon thing.

Still have access to Windows 7 and maybe Windows XP for some occasional testing.