declare const arr: number[];
arr.push(1);
arr.unshift(2);
=>
-- Lua Library inline imports
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
function __TS__ArrayPush(arr, ...)
local items = ({...})
for ____, item in ipairs(items) do
arr[#arr + 1] = item
end
return #arr
end
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
function __TS__ArrayUnshift(arr, ...)
local items = ({...})
do
local i = #items - 1
while i >= 0 do
table.insert(arr, 1, items[i + 1])
i = i - 1
end
end
return #arr
end
__TS__ArrayPush(arr, 1)
__TS__ArrayUnshift(arr, 2)
Built with:
> tstl main.ts --noHeader
or with tsconfig containing:
{
tstl: {
"noHeader": true
}
}
=>
Built with:
or with tsconfig containing: