Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions 5.3.d.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/// <reference path="./core/index.d.ts" />
/// <reference path="./special/5.3.d.ts" />
/// <reference path="./version-specific-functions/utf8-decode/utf8-offset-5.3-5.4.d.ts" />
1 change: 1 addition & 0 deletions 5.4.d.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/// <reference path="./core/index.d.ts" />
/// <reference path="./special/5.4.d.ts" />
/// <reference path="./version-specific-functions/utf8-decode/utf8-offset-5.3-5.4.d.ts" />
3 changes: 3 additions & 0 deletions 5.5.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/// <reference path="./core/index.d.ts" />
/// <reference path="./special/5.5.d.ts" />
/// <reference path="./version-specific-functions/utf8-decode/utf8-offset-5.5.d.ts" />
3,502 changes: 1,646 additions & 1,856 deletions package-lock.json

Large diffs are not rendered by default.

15 changes: 0 additions & 15 deletions special/5.3-plus.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,21 +165,6 @@ declare namespace utf8 {
* position of the first invalid byte.
*/
function len(s: string, i?: number, j?: number): number;

/**
* Returns the position (in bytes) where the encoding of the n-th character of
* s (counting from position i) starts. A negative n gets characters before
* position i. The default for i is 1 when n is non-negative and #s + 1
* otherwise, so that utf8.offset(s, -n) gets the offset of the n-th character
* from the end of the string. If the specified character is neither in the
* subject nor right after its end, the function returns nil.
*
* As a special case, when n is 0 the function returns the start of the
* encoding of the character that contains the i-th byte of s.
*
* This function assumes that s is a valid UTF-8 string.
*/
function offset(s: string, n?: number, i?: number): number;
}

interface LuaMetatable<T> {
Expand Down
13 changes: 13 additions & 0 deletions special/5.5-plus.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/** @noSelfInFile */

declare namespace table {
/**
* Creates a new empty table, preallocating memory. This preallocation may help
* performance and save memory when you know in advance how many elements the
* table will have.
*
* @param nseq hint for how many elements the table will have as a sequence
* @param nrec (optional) hint for how many other elements the table will have; its default is zero.
*/
function create<T>(nseq: number, nrec?: number): T[];
}
2 changes: 2 additions & 0 deletions special/5.5.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/// <reference path="./5.4.d.ts" />
/// <reference path="./5.5-plus.d.ts" />
30 changes: 30 additions & 0 deletions version-specific-functions/utf8-decode/utf8-offset-5.3-5.4.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// https://www.lua.org/manual/5.3/manual.html#6.5

/**
* This library provides basic support for UTF-8 encoding. It provides all its
* functions inside the table utf8. This library does not provide any support
* for Unicode other than the handling of the encoding. Any operation that needs
* the meaning of a character, such as character classification, is outside its
* scope.
*
* Unless stated otherwise, all functions that expect a byte position as a
* parameter assume that the given position is either the start of a byte
* sequence or one plus the length of the subject string. As in the string
* library, negative indices count from the end of the string.
*/
declare namespace utf8 {
/**
* Returns the position (in bytes) where the encoding of the n-th character of
* s (counting from position i) starts. A negative n gets characters before
* position i. The default for i is 1 when n is non-negative and #s + 1
* otherwise, so that utf8.offset(s, -n) gets the offset of the n-th character
* from the end of the string. If the specified character is neither in the
* subject nor right after its end, the function returns nil.
*
* As a special case, when n is 0 the function returns the start of the
* encoding of the character that contains the i-th byte of s.
*
* This function assumes that s is a valid UTF-8 string.
*/
function offset(s: string, n?: number, i?: number): number;
}
35 changes: 35 additions & 0 deletions version-specific-functions/utf8-decode/utf8-offset-5.5.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// https://www.lua.org/manual/5.5/manual.html#6.6

/**
* This library provides basic support for UTF-8 encoding. It provides all its
* functions inside the table utf8. This library does not provide any support
* for Unicode other than the handling of the encoding. Any operation that needs
* the meaning of a character, such as character classification, is outside its
* scope.
*
* Unless stated otherwise, all functions that expect a byte position as a
* parameter assume that the given position is either the start of a byte
* sequence or one plus the length of the subject string. As in the string
* library, negative indices count from the end of the string.
*/
declare namespace utf8 {
/**
* Returns the position of the n-th character of s (counting from byte
* position i) as two integers: The index (in bytes) where its encoding
* starts and the index (in bytes) where it ends.
*
* If the specified character is right after the end of s, the function
* behaves as if there was a '\0' there. If the specified character is
* neither in the subject nor right after its end, the function returns fail.
*
* A negative n gets characters before position i. The default for i is 1
* when n is non-negative and #s + 1 otherwise, so that utf8.offset(s,-n)
* gets the offset of the n-th character from the end of the string.
*
* As a special case, when n is 0 the function returns the start of the
* encoding of the character that contains the i-th byte of s.
*
* This function assumes that s is a valid UTF-8 string.
*/
function offset(s: string, n?: number, i?: number): LuaMultiReturn<[number, number]>;
}