robin/laufey
git clone https://git.robinwobin.dev/robin/laufey
aa1d8a2702
master
1-- Basic shim for LuaJIT's table.new and table.clear. 2local has_new , new =pcall ( require , 'table.new' ) 3local has_clear , clear =pcall ( require , 'table.clear' ) 4 5local M ={} 6 7if not has_new then 8new =function ( _narr , _nrec ) 9return {} 10end 11end 12 13if not has_clear then 14--- @param tab table 15clear =function ( tab ) 16for k in pairs ( tab ) do 17tab [ k ] =nil 18end 19end 20end 21 22---@cast new fun(narr: integer, nrec: integer): table 23---@cast clear fun(tab: table) 24M . new =new 25M . clear =clear 26 27return M