You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add a def file to the project declaring custom functions in the global table module. For example:
---Createsapre-sizedtable,justliketheCAPIequivalent---`lua_createtable`. This is useful for big tables if the final table size is---knownandautomatictableresizingistooexpensive.---@overloadfun(narr:number):table---@paramnarrnumber---@paramnrecnumber---@returntablefunctiontable.new(narr, nrec) end---Clearsallkeysandvaluesfromatable,butpreservestheallocatedarray/hashsizes.---Thisisusefulwhenatable,whichislinkedfrom---multipleplaces,needstobeclearedand/orwhenrecyclingatableforuse---bythesamecontext.Thisavoidsmanagingbacklinks,savesanallocation---andtheoverheadofincrementalarray/hashpartgrowth.------Pleasenote,thisfunctionismeantforveryspecificsituations.Inmost---casesit's better to replace the (usually single) link with a new table---andlettheGCdoitswork.---@paramttablefunctiontable.clear(t) end
What happens?
Custom function definitions are ignored and uses are reported as errors.
What were you expecting to happen?
Custom function definitions should be merged with the std definitions as is the case for example with the math module.
Any other comments?
The "table" type is not the same thing as the "table" module and this is an important distinction. As far as the module goes it could have been given a different name altogether like "container" just as the "math" module is not called "number". It just happens that the type and the module share the same name in this case. Also consider that many lua frameworks add custom functions to std modules as extensions (for example, Premake) which causes a lot of false errors to be reported.
The text was updated successfully, but these errors were encountered:
Environment
Lua
Type Safety
What are the steps to reproduce this issue?
What happens?
Custom function definitions are ignored and uses are reported as errors.
What were you expecting to happen?
Custom function definitions should be merged with the std definitions as is the case for example with the math module.
Any other comments?
The "table" type is not the same thing as the "table" module and this is an important distinction. As far as the module goes it could have been given a different name altogether like "container" just as the "math" module is not called "number". It just happens that the type and the module share the same name in this case. Also consider that many lua frameworks add custom functions to std modules as extensions (for example, Premake) which causes a lot of false errors to be reported.
The text was updated successfully, but these errors were encountered: