Skip to content

Support LuaJIT's table.new and table.clear #1118

@liquidev

Description

@liquidev

These are (as far as I know) undocumented functions that LuaJIT provides after you require "table.new" and require "table.clear" respectively.

table.new is a binding to lua_createtable, which allows you to preallocate a table with a specified amount of elements in the array part and the record part. The signature is as follows:

function table.new(narr: number, nrec: number): table

table.clear is a binding to lj_tab_clear, which clears a table without having to iterate over all of its elements. Its signature is as follows:

function table.clear(t: table)

Right now if you try to use either of them, the language server complains that they don't exist:
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions