Skip to content

File object file_class and File inconsistent #61

@luttje

Description

@luttje

According to the wiki file.Open returns a file_class

On the file_class page the type name is specified as File:

<ambig page="file">You might be looking for the "file" Library, which has the same name as this class.</ambig>

<type name="File" category="classfunc" is="class">
	<summary>This is the file object. It used used primarily to read or write binary data from files.  
The default endianness is little-endian. To use big-endian you will need to provide your own functions to read and write shorts and longs.

		The object is returned by <page>file.Open</page>.
	</summary>
</type>

This causes neither type to be correct when using file.Open:

The generated library and class annotations for reference: https://github.com/luttje/glua-api-snippets/blob/lua-language-server-addon/library/file.lua

I guess this is done on the wiki because of case insensitivity, so there can't be File and file page for the class and library respectively.

Possible Solutions

What I can think of right now:

  • Changing the wiki in some way (seems cumbersome)
  • Adding a way to transform scraped data according to a list of exceptions/rules, in this case: replacing file_class with File
  • Using the name attribute instead of the type attribute from the file.Open function wiki (not sure if that would be correct everywhere):
    <ret name="File" type="file_class">The opened file object, or `nil` if it failed to open due to it not existing or being used by another process.</ret>

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions