News : The level of daily SPAM has reached insane proportions, all registrations are now manual. I ask you to send me an e-mail (john (at) murga (dot) org), to confirm that you want me to create an account for you.

Post Reply  Post Thread 
Visual Lua
Author Message

Posts: 113
Group: Registered
Joined: Jul 2007
Status: Offline
Reputation: 0
Post: #1
Visual Lua


To celebrate the upcoming, long-expected release of the next version of murgaLua, I came up with a new toy project:

Making an FLTK interface that would allow for creating Lua programs graphically.
I got this idea from different tools, like Matlab's Simulink, vistrails visualization workflows, etc etc.

I think it might be very useful for prototyping, for education (think explaining programming to kids), visualization of data for less programatic minded people etc.

The idea would be to have a set of blocks that would have in- and output ports that can be connected with lines. This would enable passing data from one block to another if run. Each block corresponds to a Lua function.

If anyone would want to join the effort, I could put up a git repo.

Now for the problems:
I'd want to separate of the logic from the GUI stuff, as to be able to port the same logic to other frontends (Why not put those blocks in a 3D space Wink). This would mean keeping all blocks, links, ... in tables. But I would need to be able to get the identity of a GUI block to associate it with the logic. A quick check however pointed out that the Fl:belowmouse() returns the correct widget, but each time packed in a new userdata object. Would it be possible to make murgaLua keep userdata objects associated with the generated widgets, as to be able to store and compare them in a list?
For now I was able to move boxes without needing the ID, just using the returned widget itself, and the FL boxtype, but as the project goes on, I will certainly need to be able to keep ID's (for example selecting multiple boxes, or using different box types for different kind of blocks, ...)

You can find the code I knocked up starting from the draggable box in the Widgets Demo attached.

Current pathetic features:
- multiple draggable boxes
- snap to (invisible) grid
Edit: New version adds:
- no initial jump when starting the drag

.lua File  visualLua.lua (Size: 3.05 KB / Downloads: 10)

This post was last modified: 05-31-2012 03:18 AM by jpjacobs.

05-30-2012 08:51 PM
Find all posts by this user Quote this message in a reply
Post Reply  Post Thread 

Messages In This Thread
Visual Lua - jpjacobs - 05-30-2012 08:51 PM
RE: Visual Lua - JohnMurga - 05-30-2012, 08:56 PM
RE: Visual Lua - JohnMurga - 06-01-2012, 03:05 AM
RE: Visual Lua - jpjacobs - 06-01-2012, 08:38 PM
RE: Visual Lua - jpjacobs - 06-03-2012, 10:49 PM
RE: Visual Lua - JohnMurga - 06-03-2012, 11:42 PM

View a Printable Version
Send this Thread to a Friend
Subscribe to this Thread | Add Thread to Favorites

Forum Jump: