Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check the methods of types #3

Open
Feufochmar opened this issue May 6, 2016 · 1 comment
Open

Check the methods of types #3

Feufochmar opened this issue May 6, 2016 · 1 comment

Comments

@Feufochmar
Copy link

Currently, the script checks if modules and functions are present. However, since Löve2D is object-oriented, the functions defined inside the tables returned by the newXXX functions are also part of the API. (or in other words, the methods on the objects returned by the constuctor functions).
Currently, the script does not check if methods are present. This requires work as it is needed to instanciate a type to check if its methods are present or missing.

When checking a type, the script should:

  1. check if the type has a constructor
  2. check the constructor definition (to check for a suitable variant to call)
  3. call the constructor
  4. check if the methods are present
  5. check if the methods of the supertypes are present

Since a constructor may need other objects to be called, it may not be possible to do the 3rd step automatically from the api description for all types. Those types could be checked with manual code for the instanciation.
The 5th step requires to build a dictionnary of the types defined by the API, as the documentation is written as a tree and not as a map.

@RobLoach
Copy link
Member

RobLoach commented May 7, 2016

Agreed, love.joystick.getJoysticks is an example of bringing in a Lua object.

Kivutar mentioned there are a few examples of returning objects in Lutro, but I haven't looked further into it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants