Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Lua Development Tools » Documenting a Function That Returns an Array
Documenting a Function That Returns an Array [message #1037137] Tue, 09 April 2013 07:54 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 #1037984 is a reply to message #1037137] Wed, 10 April 2013 08:51 Go to previous messageGo to next message
Kevin KIN-FOO is currently offline Kevin KIN-FOOFriend
Messages: 58
Registered: January 2010
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 #1037995 is a reply to message #1037984] 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
[Copy, sorry]

[Updated on: Wed, 10 April 2013 09:07]

Report message to a moderator

Re: Documenting a Function That Returns an Array [message #1037996 is a reply to message #1037984] 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)

  return users
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!

[Updated on: Thu, 11 April 2013 11:51]

Report message to a moderator

Re: Documenting a Function That Returns an Array [message #1038031 is a reply to message #1037996] Wed, 10 April 2013 10:07 Go to previous messageGo to next message
Kevin KIN-FOO is currently offline Kevin KIN-FOOFriend
Messages: 58
Registered: January 2010
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 #1038840 is a reply to message #1038031] 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 B405458.
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 #1039812 is a reply to message #1038840] Fri, 12 April 2013 16:18 Go to previous message
Simon Bernard is currently offline Simon BernardFriend
Messages: 345
Registered: July 2009
Senior Member
We should first make a decision about the syntax.
I propose to start the discussion on bugzilla.
Previous Topic:Problem using Mihini EE with LDT 0.9 under Win 7
Next Topic:LDT with luabind
Goto Forum:
  


Current Time: Sun Oct 06 16:54:44 GMT 2024

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

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

Back to the top