Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Lua Development Tools » Help with Love2D EE (enums, function overloading)
Help with Love2D EE (enums, function overloading) [message #1691202] Fri, 03 April 2015 10:51 Go to next message
lea fi is currently offline lea fiFriend
Messages: 2
Registered: April 2015
Junior Member
Hi all,

I've started work on a Love2D 0.9.2 execution environment.
I've written a tool to generate the necessary LDT-format LuaDoc suitable for an file ( ),
and you can download the results so far by grabbing a tagged release zip from another repository ( ).

It's going pretty well. I'm at the stage where you can create an image with e.g. local img ="a.png"), and you'd get autocompletion for e.g. img:getWidth(), img:getHeight() and the like.

There's a few issues, though, which I'd really appreciate your advice on:

  • Enums. For example, when a function returns an argument of type window#FullscreenType, I do currently emit that but I do not emit a definition for window#FullscreenType.
    In Love2D, all enums are really of type string, but the valid possible strings are known in advance.
    (For window#FullscreenType, the valid values would be either "normal" or "desktop".)
    What would be the best way to encode enums in LuaDoc?

  • Overloaded functions. Many functions in Love2D have a few different 'overloads' for the same function. Really, it's the same function, but there is different documentation depending on what you pass.
    See for an example.
    My source data (from ) correctly encodes all of these, but right now I emit only the first one I see, which isn't always ideal.
    What would be the best way to show that these functions are overloaded? Is there any support for this in LuaDoc?

  • Run configurations. Can I specify these inside the execution environment? It would make it a lot easier for new users to get started, and to ensure the working directory is correct.
    I am shipping a default project template at the moment, so I could do whatever jiggery pokery is necessary to get the debugger up and running.

Thanks in advance.

(Also, phooey to not being able to properly format links until I have 5 messages posted.)
Re: Help with Love2D EE (enums, function overloading) [message #1691233 is a reply to message #1691202] Fri, 03 April 2015 16:21 Go to previous messageGo to next message
Marc Aubry is currently offline Marc AubryFriend
Messages: 86
Registered: August 2012
Hi Lea,

I have checkout your EE, nice work so far.

To anwser your questions:

  • Currently, there is no way to declare an enum. In facts LDT does type-cheking but not value-checking. The best you can do is to set the type as "#string" and precise in the statement description which values are accepted.

  • I am not sure to understand, but it seems that in graphic there is more than one newImage method. You are right, in LDT, it's not possible to add twice the same method same to a module even with different parameters. This is because the Lua language it self doesn't allow to put in a table 2 different values under the same key, as Lua modules are implemented using table, we have the same limitation.

    Again, the solution might be to combinate the descriptions of method in the same LuaDocumentor declaration. Here an exemple using some html formating.

    -- Creates a new Image.
    -- @function [parent = #graphics] newImage
    -- @param image The image, can be 3 types: <br/>
    --  <ul>
    --  <li> @{#string} The filepath to the image file.</li>
    --  <li> @{image#ImageData} An ImageData object. The Image will use this ImageData to reload itself when love.window.setMode is called.</li>
    --  <li> @{image#CompressedData} A CompressedData object. The Image will use this CompressedData to reload itself when love.window.setMode is called.</li>
    --  </ul> 
    -- @param image#TextureFormat format [optional] If the first parameter is a filepath, here is the format to interpret the image's data as. 
    -- @return graphics#Image image An Image object which can be drawn on screen.

    I am aware that is not satisfactory, I this use case really brother you, let it know there is maybe something to do here.

  • About the run configuration, if by configuration you mean to run your project using the right interperter see 1), if run configuration means advanced run and debug configuration more than only the interpreter see 2).

    1) The interpreter information is not carried by the project, so you can't set it using an Execution Environment. But when you add an interpreter through the preferences, you can link it an EE. So if users link their Love2D interpreter to the Love2D Execution Environment, when running a project with the Love2D Execution Environment, it will use the Love2D interpreter.

    2) The Execution Environment can't carried theses informations, but you may use the Eclipse launch configuration import/export feature, see

I hope this is clean and will help you, if I have misleading one of your question, please precise your mind.

Re: Help with Love2D EE (enums, function overloading) [message #1691237 is a reply to message #1691233] Fri, 03 April 2015 17:15 Go to previous message
lea fi is currently offline lea fiFriend
Messages: 2
Registered: April 2015
Junior Member

Thanks for your help. I just wanted to be sure I hadn't missed anything.

I will definitely implement your suggestion for enums at some point, and I will look into using <ul>, <li> etc to form lists of possible parameter types in method documentation. The idea hadn't occurred to me.

For the run configuration I'll try to just make some documentation/a how-to guide for users to follow.

(I'll get this all done eventually, but probably not soon.)
Previous Topic:step over c function luaL_error
Next Topic:LDT - How to stop the file tab, showing the full path text?
Goto Forum:

Current Time: Sun Oct 02 03:34:45 GMT 2022

Powered by FUDForum. Page generated in 0.02085 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top