Documenting a Function That Returns an Array [message #1037137] |
Tue, 09 April 2013 03:54  |
Eclipse User |
|
|
|
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 #1037996 is a reply to message #1037984] |
Wed, 10 April 2013 05:07   |
Eclipse User |
|
|
|
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 07:51] by Moderator
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.07398 seconds