This repository has been archived by the owner on Nov 4, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
258 additions
and
190 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// https://lua-api.factorio.com/latest/LuaLazyLoadedValue.html | ||
|
||
export type LuaLazyLoadedValue<T> = { | ||
/** Is this object valid? */ | ||
readonly valid: boolean; | ||
/** The class name of this object. */ | ||
readonly object_name: string; | ||
/** Gets the value of this lazy loaded value. */ | ||
get: () => T; | ||
/** All methods, and properties that this object supports. */ | ||
help: () => string; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/** This function allows to log LocalisedStrings to the Factorio log file. This, in combination with serpent, makes debugging in the data stage easier, because it allows to simply inspect entire prototype tables. For example, this allows to see all properties of the sulfur item prototype: log(serpent.block(data.raw["item"]["sulfur"])) */ | ||
// @ts-ignore | ||
declare const log: (ls: LocalisedString) => void; | ||
|
||
/** This function allows printing LocalisedStrings to stdout without polluting the logfile. This is primarily useful for communicating with external tools that launch Factorio as a child process. */ | ||
declare const localised_print: typeof log; | ||
|
||
declare const table_size: <T extends {}>(v: T) => number; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
type SerpentOptions = { | ||
/** indentation; triggers long multi-line output. */ | ||
indent: string; | ||
/** provide stringified value in a comment (up to maxlevel of depth). */ | ||
comment: boolean | number; | ||
/** sort keys. */ | ||
sortkeys: boolean | ((...args: unknown[]) => any); | ||
/** force sparse encoding (no nil filling based on #t). */ | ||
sparse: boolean; | ||
/** remove spaces. */ | ||
compact: boolean; | ||
/** raise fatal error on non-serilizable values. */ | ||
fatal: boolean; | ||
/** disable bytecode serialization for easy comparison. */ | ||
nocode: boolean; | ||
/** disable checking numbers against undefined and huge values. */ | ||
nohuge: boolean; | ||
/** specify max level up to which to expand nested tables. */ | ||
maxlevel: number; | ||
/** specify max number of elements in a table. */ | ||
maxnum: number; | ||
/** specify max length for all table elements. */ | ||
maxlength: number; | ||
/** use __tostring metamethod when serializing tables (v0.29); set to false to disable and serialize the table as is, even when __tostring is present. */ | ||
metatostring: boolean; | ||
/** specify format for numeric values as shortest possible round-trippable double (v0.30). Use "%.16g" for better readability and "%.17g" (the default value) to preserve floating point precision. */ | ||
numformat: string; | ||
/** allows to specify a list of values to ignore (as keys). */ | ||
valignore: string[]; | ||
/** allows to specify the list of keys to be serialized. Any keys not in this list are not included in final output (as keys). */ | ||
keyallow: string[]; | ||
/** allows to specity the list of keys to ignore in serialization. */ | ||
keyignore: string[]; | ||
/** allows to specify a list of value types to ignore (as keys). */ | ||
valtypeignore: string[]; | ||
/** provide custom output for tables. */ | ||
custom: (opts: { | ||
/** the name of the current element with '=' or an empty string in case of array index, */ | ||
tag: any; | ||
/** an opening table bracket { and associated indentation and newline (if any), */ | ||
head: any; | ||
/** table elements concatenated into a string using commas and indentation/newlines (if any), */ | ||
body: any; | ||
/** a closing table bracket } and associated indentation and newline (if any), and */ | ||
tail: any; | ||
/** the current level. */ | ||
level: any; | ||
}) => any; | ||
/** name; triggers full serialization with self-ref section. */ | ||
name: string; | ||
}; | ||
declare const serpent: { | ||
/** full serialization; sets name, compact and sparse options; */ | ||
dump(tbl: any, options?: SerpentOptions): string; | ||
/** single line pretty printing, no self-ref section; sets sortkeys and comment options; */ | ||
line(tbl: any, options?: SerpentOptions): string; | ||
/** multi-line indented pretty printing, no self-ref section; sets indent, sortkeys, and comment options. */ | ||
block(tbl: any, options?: SerpentOptions): string; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.