Giter Club home page Giter Club logo

Comments (5)

pakozm avatar pakozm commented on August 16, 2024

It is not a bug. april_help can't work with the given table. It needs to know the table name (as string) because the documentation is stored at an auxiliar table which replicates the hierarchy of namespaces and tables of April.

from april-ann.

joapaspe avatar joapaspe commented on August 16, 2024

Anyway, it would be very easy to improve april_help for dealing with tables:

if type(obj) == table then
print("Table ", #table)
for i, v in ipairs(table) do
print(i, v)
end
fi

isn't it? I don't know how determine if it is a pure table (integer indexes) or a dictionary...

from april-ann.

Baha avatar Baha commented on August 16, 2024

The obvious (and long) solution for that would be to iterate the values of the table and check if every entry is an integer. If some key is not an integer, then the table is a dictionary.

I don't know if there are more efficient solutions for that 🐵

from april-ann.

pakozm avatar pakozm commented on August 16, 2024

It is not as easy to deal with tables... the problem is that a table could be a lot of things.
april_help is designed to work with documented objects and structures of April. If you want a ipairs or pairs throught the table, it is simple, do it by yourself ;-) But the ipairs will not show documentation, only methods at the given table.

I mean, what you are asking is a different thing which has nothing to do with april_help. If you want, it is possible to add in "utils.lua" a simple function:

function print_table_pairs OR WHATEVER NAME(t) for i,v in pairs(t) do print(i,v) end

Bests.

from april-ann.

pakozm avatar pakozm commented on August 16, 2024

I forgot to explain one more thing. april_help leads with tables actually. But for other purposes. Look this example:

thenet = ann.components.stack()
april_help(thenet)

This piece of code shows the documentation associated with ann.components.stack. It is not the same as a pairs or ipairs, because the object has inheritance, and april_help goes through internal structure of April C++/Lua classes.

from april-ann.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.