Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Koneki » Documenting a Function That Returns an Array
Documenting a Function That Returns an Array [message #1416844] Tue, 09 April 2013 13:05 Go to next message
Assaf Inbal is currently offline Assaf InbalFriend
Messages: 8
Registered: April 2013
Junior Member
Hey all,

I'm trying to document my API for auto-completion and all.
I have a function which returns an array (table without defined keys) where each item is a table with a few fields.

I already know how to create the table with its fields, but how do I define the array type which the function returns?

Thanks!
Re: Documenting a Function That Returns an Array [message #1416847 is a reply to message #1416844] Wed, 10 April 2013 08:51 Go to previous messageGo to next message
Kevin KIN-FOO is currently offline Kevin KIN-FOOFriend
Messages: 28
Registered: July 2009
Junior Member
Hi,

I think you are talking about a regular Lua table, so you can use #table as listed in documentation[1].

Regards

[1] http://wiki.eclipse.org/Koneki/LDT/User_Area/Documentation_Language#Primitive_references
Re: Documenting a Function That Returns an Array [message #1416848 is a reply to message #1416847] Wed, 10 April 2013 09:06 Go to previous messageGo to next message
Assaf Inbal is currently offline Assaf InbalFriend
Messages: 8
Registered: April 2013
Junior Member
Perhaps I'm missing something, so I'll give a better example of what I'm after.

Suppose I have the following code:

function get_users()
local user1 = {
name = "foo",
age = 20,
}
local user2 = {
name = "bar",
age = 20,
}
local users = {}
table.insert(users, user1)
table.insert(users, user2)
end

users = get_users()

Now, I want to be able to have auto completion for the keys of each value in the users table.
For example:

users[1].<auto complete here (name or age)>

or

for _, user in pairs(users) do
print(user.<auto complete here (name or age)>)
end

I know how to document a function that returns a single user (a table with name/age keys), but, how would I go about writing the documentation for the get_users() function?

Thanks again for any help!
Re: Documenting a Function That Returns an Array [message #1416849 is a reply to message #1416847] Wed, 10 April 2013 09:07 Go to previous messageGo to next message
Assaf Inbal is currently offline Assaf InbalFriend
Messages: 8
Registered: April 2013
Junior Member
Perhaps I'm missing something, so I'll give a better example of what I'm after.

Suppose I have the following code:

function get_users()
local user1 = {
name = "foo",
age = 20,
}
local user2 = {
name = "bar",
age = 20,
}
local users = {}
table.insert(users, user1)
table.insert(users, user2)
end

users = get_users()

Now, I want to be able to have auto completion for the keys of each value in the users table.
For example:

users[1].<auto complete here (name or age)>

or

for _, user in pairs(users) do
print(user.<auto complete here (name or age)>)
end

I know how to document a function that returns a single user (a table with name/age keys), but, how would I go about writing the documentation for the get_users() function?

Thanks again for any help!
Re: Documenting a Function That Returns an Array [message #1416850 is a reply to message #1416849] Wed, 10 April 2013 10:07 Go to previous messageGo to next message
Kevin KIN-FOO is currently offline Kevin KIN-FOOFriend
Messages: 28
Registered: July 2009
Junior Member
Hi,

So far it is not implemented. We did not address this problem yet, but it might be useful.
You can file a bug[1] (in this case an enhancement). This way we won't forget it when there will be room in our backlog.

Regards

[1] https://bugs.eclipse.org/bugs/enter_bug.cgi?product=Koneki&component=LuaTools
Re: Documenting a Function That Returns an Array [message #1416851 is a reply to message #1416850] Thu, 11 April 2013 12:06 Go to previous messageGo to next message
Assaf Inbal is currently offline Assaf InbalFriend
Messages: 8
Registered: April 2013
Junior Member
Thanks for confirming that for me. I've opened https://bugs.eclipse.org/bugs/show_bug.cgi?id=405458.
Assuming I might be able to implement this myself, could you give me some pointers as to where to start?

I'm knowledgeable in both Java and Lua, but have never written plugins for Eclipse.
Re: Documenting a Function That Returns an Array [message #1416855 is a reply to message #1416851] Fri, 12 April 2013 16:18 Go to previous message
Simon Bernard is currently offline Simon BernardFriend
Messages: 337
Registered: July 2009
Senior Member
We should first make a decision about the syntax.
I propose to start the discussion on https://bugs.eclipse.org/bugs/show_bug.cgi?id=405458.
Previous Topic:Is there no Exec within Funambol 3.6? (FUMO)
Next Topic:LDT with luabind
Goto Forum:
  


Current Time: Mon Sep 24 13:36:49 GMT 2018

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

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

Back to the top