Hi there,
Note: this is still a work in progress
Lately I've been (re)working on a Lua project and as the project grow bigger and bigger and thought it would be nice take a break with writing barely readable script with some fuzzy logic, like we can find a lot on this site.
So I did some research to learn how to get thing done with an OO lua way and after I the wall several time to actually understand what's going on with object lua from a library to an another, I found the
Koneki project. Basicly, it's a Lua IDE based on Eclipse, but it has a couple a cool features that make it worth using it, rather than some other IDE/text editor.
Now, I don't want to show off useless stuff, but this is still a big deal to help new comer to Lua with ambitious project. But here is the major feature that hooked my interest:
* Using luadoc as way to trigger autocompletion over severals modules.
This is simply genius. Not only you have to actually think about how to structure the lua code in an OO fashion, but you have to do it while adding doc, so other can directly understand.
So here's my idea for now: encourage lua user to stop doing trial and error with the lua console from his favorite emulator and make them try to actually run the code on a IDE that running with a standalone lua 5.1 for a completly new programming experience. But as you might expect, the major encombrance here's is that the core function from the emulator aren't avalaible, so we have to provide them.
Here's a
picture about what I'm talking about. The following code describe how to handle the embedded module that try to mimic the emulator API...
Language: lua
---The gui Library
-- Functions mainly for drawing on the screen are in the gui library.
-- @module gui
if _G.gui then
return _G.gui;
end
local gui={};
--- Register a function to be called between a frame being prepared for displaying
-- on your screen and it actually happening. Used when that 1 frame delay for
-- rendering is not acceptable.
function gui.register(func) end
---Returns a screen shot as a string in gd's v1 file format.
-- This allows us to make screen shots available without gd installed locally.
-- Users can also just grab pixels via substring selection.
-- @usage Usage examples:
-- gd.createFromGdStr(gui.gdscreenshot()):png("outputimage.png")
-- @return #string
function gui.gdscreenshot() end
--more luadoc
return gui;
So, how neat is that? Basicly, just "mock" all the functions and your good to go. The script will run fine on both standalone lua and your favorite emulator.
You can see
a project here that try to use this kind of framework.
Also, I did a couple of testing with iup library and I believe we can easily create interactive windows form that doesn't lag while the emulator is running with any emulator(even those that doesn't support the fceux auxlibs). Here's an
implemention that does work. So yeah, I'm pretty sure this the kind of stuff that could become very handy for some project.
I do have a couple other idea, such as adding advanced math function like integral(f,x,a,b), so it make it easier for user trying to program some cool algorithms, etc.
So that's about it, if there's any interest I'll probably make a quick tutorial about how to setup Koneki, since like any Eclipse-based IDE... there's 2-3 thing to config first, before been able to use it correctly.