Client#
__index#
Client
acknowledgeMaxSize#
integer
amIClient#
function Client.amIClient(self: Client)
-> true: boolean
Checks if the current local user is a client.
@return true
— if client, false if not
See: Server.amIServer
customProfiler#
CustomProfiler
Simple profiler that can be used to measure the duration of a function and the memory usage of a function.
entityCache#
EntityCache
entityUtils#
EntityUtils
fileUtils#
FileUtils
getAckCacheSize#
function Client.getAckCacheSize(self: Client)
-> cacheSize: number
Mainly for profiling. Returns then network cache, aka acknowledge.
globalUtils#
GlobalsUtils
globalsUtils#
GlobalsUtils
guid#
nil
guidUtils#
GuidUtils
GuidUtils is just for generating and validating GUIDs. Guids are used for identifying clients and servers.
health#
table
iAm#
string
logger#
Logger
minaUtils#
MinaUtils
Util class for fetching information about local and remote minas.
missingMods#
nil
name#
nil
networkCache#
NetworkCache
networkCacheUtils#
NetworkCacheUtils
networkUtils#
NetworkUtils
networkVscUtils#
NetworkVscUtils
NetworkVscUtils for getting and setting values in VariableStorageComponents of Noita-API
new#
function Client.new(clientObject: Client|nil, serverOrAddress: string|nil, port: number|nil, maxChannels: number|nil, server: Server, np: noitapatcher)
-> Client
Client constructor. Inherits from SockClient sock.Client.
@param server
— required
@param np
— required
noitaComponentUtils#
NoitaComponentUtils
Class for using Noita components.
noitaMpSettings#
NoitaMpSettings
NoitaMpSettings: Replacement for Noita ModSettings.
noitaPatcherUtils#
NoitaPatcherUtils
nuid#
nil
otherClients#
table
preConnect#
function Client.preConnect(self: Client, ip: string|nil, port: number|nil, code: number|nil)
Connects to a server on ip and port. Both can be nil, then ModSettings will be used. Inherit from sock.connect.
@param ip
— localhost or 127.0.0.1 or nil
@param port
— port number from 1 to max of 65535 or nil
@param code
— connection code 0 = connecting first time, 1 = connected second time with loaded seed
See: ~sock.connect~
preDisconnect#
function Client.preDisconnect(self: Client)
Disconnects from the server. See: ~SockClient.disconnect~
preSend#
function Client.preSend(self: Client, event: string, data: table)
-> true: boolean
Sends a message to the server. Inherit from sock.send.
@param event
— required
@param data
— required
@return true
— if message was sent, false if not
See: ~sock.send~
preUpdate#
function Client.preUpdate(self: Client, startFrameTime: number)
Updates the Client by checking for network events and handling them. Inherit from sock.update.
@param startFrameTime
— required
See: ~SockClient.update~
requiredMods#
nil
sendDeadNuids#
function Client.sendDeadNuids(self: Client, deadNuids: table)
-> true: boolean
Sends dead nuids to the server.
@param deadNuids
— required
@return true
— if message was sent, false if not
sendEntityData#
function Client.sendEntityData(self: Client, entityId: number)
Sends entity data to the server.
@param entityId
— required
sendLostNuid#
function Client.sendLostNuid(self: Client, nuid: number)
-> true: boolean
Sends a message that the client has a nuid, but no linked entity.
@param nuid
— required
@return true
— if message was sent, false if not
sendMinaInformation#
function Client.sendMinaInformation(self: Client)
-> boolean
Sends mina information to the server.
sendNeedNuid#
function Client.sendNeedNuid(self: Client, ownerName: string, ownerGuid: string, entityId: number)
Sends a message to the server that the client needs a nuid.
server#
Server
serverInfo#
table
syncedMods#
boolean
transform#
table
utils#
Utils
Utils class for lazy developers.
zipTable#
function
CustomProfiler#
Simple profiler that can be used to measure the duration of a function and the memory usage of a function.
ffi#
unknown
fileUtils#
FileUtils
getSize#
function CustomProfiler.getSize(self: CustomProfiler)
-> size: number
Returns the size of the report cache.
init#
function CustomProfiler.init(self: CustomProfiler)
new#
function CustomProfiler.new(self: CustomProfiler, customProfiler: CustomProfiler|nil, fileUtils: FileUtils|nil, noitaMpSettings: NoitaMpSettings, plotly: plotly|nil, socket: socket|nil, utils: Utils|nil, winapi: winapi|nil)
-> CustomProfiler
CustomProfiler constructor.
@param customProfiler
— require("CustomProfiler") or nil
@param fileUtils
— can be nil
@param noitaMpSettings
— required
@param plotly
— can be nil
@param socket
— can be nil
@param utils
— can be nil
@param winapi
— can be nil
noitaMpSettings#
NoitaMpSettings
NoitaMpSettings: Replacement for Noita ModSettings.
plotly#
plotly
:new()
report#
function CustomProfiler.report(self: CustomProfiler)
Creates a report of all the functions that were profiled into profiler_2022-11-24_20-23-00.json
socket#
socket
start#
function CustomProfiler.start(self: CustomProfiler, functionName: string)
-> returnCounter: number
Starts the profiler. This has to be called before the function (or first line of function code) that you want to measure.
@param functionName
— The name of the function that you want to measure. This has to be the same as the one used in CustomProfiler:stop(functionName, customProfilerCounter)
@return returnCounter
— The counter that is used to determine the order of the function calls. This has to be passed to CustomProfiler:stop(functionName, customProfilerCounter)
See: CustomProfiler stop(functionName, customProfilerCounter)
startExternalProfiler#
function CustomProfiler.startExternalProfiler(self: CustomProfiler, pid: number)
Starts the external profiler.
@param pid
— The process id of Noita.
stop#
function CustomProfiler.stop(self: CustomProfiler, functionName: string, customProfilerCounter: number)
-> integer
Stops the profiler. This has to be called after the function (or last line of function code, but before any return
) that you want to measure.
@param functionName
— The name of the function that you want to measure. This has to be the same as the one used in @see CustomProfiler.start(functionName)
@param customProfilerCounter
— The counter that is used to determine the order of the function calls. This has to same as the one returned by @see CustomProfiler.start(functionName)
udp#
unknown
utils#
Utils
:new()
winapi#
winapi
EntityCache#
contains#
function EntityCache.contains(self: EntityCache, entityId: any)
-> boolean
customProfiler#
CustomProfiler
Simple profiler that can be used to measure the duration of a function and the memory usage of a function.
delete#
function EntityCache.delete(self: EntityCache, entityId: any)
deleteNuid#
function EntityCache.deleteNuid(self: EntityCache, nuid: any)
entityUtils#
EntityUtils|nil
get#
function EntityCache.get(self: EntityCache, entityId: any)
-> unknown|nil
getNuid#
function EntityCache.getNuid(self: EntityCache, nuid: any)
new#
function EntityCache.new(self: EntityCache, entityCacheObject: EntityCache|nil, customProfiler: CustomProfiler, entityUtils: EntityUtils|nil, utils: Utils|nil)
-> EntityCache
EntityCache constructor
@param entityCacheObject
— optional
@param customProfiler
— required
@param entityUtils
— optional
@param utils
— optional
set#
function EntityCache.set(self: EntityCache, entityId: any, nuid: any, ownerGuid: any, ownerName: any, filepath: any, x: any, y: any, rotation: any, velX: any, velY: any, currentHealth: any, maxHealth: any, fullySerialised: any, serialisedRootEntity: any)
size#
function EntityCache.size(self: EntityCache)
-> integer|unknown
usage#
function EntityCache.usage(self: EntityCache)
utils#
Utils
Utils class for lazy developers.
EntityCacheUtils#
customProfiler#
CustomProfiler
Simple profiler that can be used to measure the duration of a function and the memory usage of a function.
entityCache#
EntityCache
new#
function EntityCacheUtils.new(self: EntityCacheUtils, entityCacheUtilsObject: EntityCacheUtils|nil, customProfiler: CustomProfiler, entityCache: EntityCache, utils: Utils|nil)
-> EntityCacheUtils
Constructor of the EntityCacheUtils class.
@param entityCacheUtilsObject
— optional
@param customProfiler
— required
@param entityCache
— required
@param utils
— optional
set#
function EntityCacheUtils.set(self: EntityCacheUtils, entityId: any, nuid: any, ownerGuid: any, ownerName: any, filepath: any, x: any, y: any, rotation: any, velX: any, velY: any, currentHealth: any, maxHealth: any, fullySerialised: any, serialisedRootEntity: any)
utils#
Utils
Utils class for lazy developers.
EntityUtils#
addOrChangeDetectionRadiusDebug#
function EntityUtils.addOrChangeDetectionRadiusDebug(self: EntityUtils, player_entity: any)
Simply adds a ugly debug circle around the player to visualize the detection radius.
client#
Client
customProfiler#
CustomProfiler
Simple profiler that can be used to measure the duration of a function and the memory usage of a function.
destroyByNuid#
function EntityUtils.destroyByNuid(self: EntityUtils, peer: any, nuid: number)
Destroys the entity by the given nuid.
@param nuid
— The nuid of the entity.
enitityCacheUtils#
EntityCacheUtils
entityCache#
EntityCache
entityCacheUtils#
EntityCacheUtils
end TODO: temporary dirty whacky hacky fix
globalsUtils#
GlobalsUtils
isEntityPolymorphed#
function EntityUtils.isEntityPolymorphed(self: EntityUtils, entityId: number)
-> boolean
Checks if a specific entity is polymorphed.
logger#
Logger
minaUtils#
MinaUtils
Util class for fetching information about local and remote minas.
networkUtils#
NetworkUtils
networkVscUtils#
NetworkVscUtils
NetworkVscUtils for getting and setting values in VariableStorageComponents of Noita-API
new#
function EntityUtils.new(self: EntityUtils, client: Client, customProfiler: CustomProfiler, enitityCacheUtils: EntityCacheUtils, entityCache: EntityCache, globalsUtils: GlobalsUtils|nil, logger: Logger|nil, minaUtils: MinaUtils, networkUtils: NetworkUtils, networkVscUtils: NetworkVscUtils, noitaComponentUtils: NoitaComponentUtils, noitaMpSettings: NoitaMpSettings, nuidUtils: NuidUtils, server: Server, utils: Utils|nil, np: noitapatcher)
-> EntityUtils
Constructor for EntityUtils. With this constructor you can override the default imports.
@param client
— required
@param customProfiler
— required
@param enitityCacheUtils
— required
@param entityCache
— required
@param globalsUtils
— optional
@param logger
— optional
@param minaUtils
— required
@param networkUtils
— required
@param networkVscUtils
— required
@param noitaComponentUtils
— required
@param noitaMpSettings
— required
@param nuidUtils
— required
@param server
— required
@param utils
— optional
@param np
— required
noitaComponentUtils#
NoitaComponentUtils
Class for using Noita components.
noitaPatcherUtils#
NoitaPatcherUtils
nuidUtils#
NuidUtils
NuidUtils for getting the current network unique identifier
onEntityRemoved#
function EntityUtils.onEntityRemoved(self: EntityUtils, entityId: any, nuid: any)
Make sure this is only be executed once!
server#
Server
spawnEntity#
function EntityUtils.spawnEntity(self: EntityUtils, owner: EntityOwner, nuid: number, x: number, y: number, rotation: number, velocity?: Vec2, filename: string, localEntityId: number, health: any, isPolymorphed: any)
-> entityId: number?
Spawns an entity and applies the transform and velocity to it. Also adds the network_component.
@param velocity
— - can be nil
@param localEntityId
— this is the initial entity_id created by server OR client. It's owner specific! Every
owner has its own entity ids.
@return entityId
— Returns the entity_id of a already existing entity, found by nuid or the newly created entity.
syncDeadNuids#
function EntityUtils.syncDeadNuids(self: EntityUtils, server: Server|nil, client: Client|nil)
Synchronises dead nuids between server and client.
@param server
— Either server or client must not be nil!
@param client
— Either server or client must not be nil!
syncEntities#
function EntityUtils.syncEntities(self: EntityUtils, startFrameTime: number, server: Server|nil, client: Client|nil)
Adds or updates all network components to the entity. Sends the entity data to all other peers.
@param startFrameTime
— Time at the very beginning of the frame.
@param server
— Either server or client must not be nil!
@param client
— Either server or client must not be nil!
utils#
Utils
Utils class for lazy developers.
FileUtils#
AppendToFile#
function FileUtils.AppendToFile(self: FileUtils, filenameAbsolutePath: string, appendContent: string)
Create7zipArchive#
function FileUtils.Create7zipArchive(self: FileUtils, archive_name: string, absolute_directory_path_to_add_archive: string, absolute_destination_path: string)
-> content: string|number
@param archive_name
— server_save06_98-09-16_23:48:10 - without file extension (*.7z)
@param absolute_directory_path_to_add_archive
— C:\Users\Ismoh-PC\AppData\LocalLow\Nolla_Games_Noita\save06
@param absolute_destination_path
— C:\Program Files (x86)\Steam\steamapps\common\Noita\mods
oita-mp_
@return content
— binary content of archive
Exists#
function FileUtils.Exists(self: FileUtils, absolutePath: string)
-> boolean
Checks if FILE or DIRECTORY exists
@param absolutePath
— full path
Exists7zip#
function FileUtils.Exists7zip(self: FileUtils)
-> boolean
Extract7zipArchive#
function FileUtils.Extract7zipArchive(self: FileUtils, archive_absolute_directory_path: string, archive_name: string, extract_absolute_directory_path: string)
@param archive_absolute_directory_path
— path to archive location like "C:\Program Files (x86)\Steam\steamapps\common\Noita\mods\noita-mp_"
@param archive_name
— server_save06_98-09-16_23:48:10.7z - with file extension (*.7z)
@param extract_absolute_directory_path
— C:\Users\Ismoh-PC\AppData\LocalLow\Nolla_Games_Noita
FestartNoita#
function FileUtils.FestartNoita(self: FileUtils)
Credits to @dextercd !
Find7zipExecutable#
function FileUtils.Find7zipExecutable(self: FileUtils)
GetAbsDirPathOfWorldStateXml#
function FileUtils.GetAbsDirPathOfWorldStateXml(self: FileUtils, saveSlotAbsDirectoryPath: string)
-> absPath: string
There is a world_state.xml per each saveSlot directory, which contains Globals. Nuid are stored in Globals.
@param saveSlotAbsDirectoryPath
— Absolute directory path to the current selected save slot.
@return absPath
— world_state.xml absolute file path
GetAbsoluteDirectoryPathOfNoitaMP#
function FileUtils.GetAbsoluteDirectoryPathOfNoitaMP(self: FileUtils, noitaMpSettings: any)
-> self.GetAbsolutePathOfNoitaRootDirectory: string
Returns the ABSOLUTE path of the mods folder. If self.GetAbsolutePathOfNoitaRootDirectory() is not set yet, then it will be
@return self.GetAbsolutePathOfNoitaRootDirectory
— ) .. "/mods/noita-mp"
GetAbsoluteDirectoryPathOfParentSave#
function FileUtils.GetAbsoluteDirectoryPathOfParentSave(self: FileUtils)
-> save06_parent_directory_path: string
Return the parent directory of the savegame directory save06. If DebugGetIsDevBuild() then Noitas installation path is returned: 'C:\Program Files (x86)\Steam\steamapps\common\Noita' otherwise it will return: '%appdata%..\LocalLow\Nolla_Games_Noita' on windows
@return save06_parent_directory_path
— string of absolute path to '..\Noita' or '..\Nolla_Games_Noita'
GetAbsoluteDirectoryPathOfRequiredLibs#
function FileUtils.GetAbsoluteDirectoryPathOfRequiredLibs(self: FileUtils)
-> self.GetAbsolutePathOfNoitaRootDirectory: string
Returns the ABSOLUTE path of the library folder required for this mod. If self.GetAbsolutePathOfNoitaRootDirectory() is not set yet, then it will be
@return self.GetAbsolutePathOfNoitaRootDirectory
— ) .. "/mods/noita-mp/files/libs"
GetAbsoluteDirectoryPathOfSave06#
function FileUtils.GetAbsoluteDirectoryPathOfSave06(self: FileUtils)
-> directory_path_of_save06: string
Returns fullpath of save06 directory on devBuild or release
@return directory_path_of_save06
— : noita installation path\save06 or %appdata%..\LocalLow\Nolla_Games_Noita\save06 on windows and unknown for unix systems
GetAbsolutePathOfNoitaMpSettingsDirectory#
function FileUtils.GetAbsolutePathOfNoitaMpSettingsDirectory(self: FileUtils, noitaMpSettings: NoitaMpSettings|nil)
-> absPath: string
Returns absolute path of NoitaMP settings directory,
@param noitaMpSettings
— optional. Needed for saving Noitas root directory to settings file.
@return absPath
— i.e. "C:\Program Files (x86)\Steam\steamapps\common\Noita\mods\noita-mp\settings"
GetAbsolutePathOfNoitaRootDirectory#
function FileUtils.GetAbsolutePathOfNoitaRootDirectory(self: FileUtils, noitaMpSettings: any)
-> string
GetAllFilesInDirectory#
function FileUtils.GetAllFilesInDirectory(self: FileUtils, directory: any, fileExtension: any)
-> table
GetDesktopDirectory#
function FileUtils.GetDesktopDirectory(self: FileUtils)
-> string|table
GetLastModifiedSaveSlots#
function FileUtils.GetLastModifiedSaveSlots(self: FileUtils)
-> table
see _G.saveSlotMeta
GetPidOfRunningEnetHostByPort#
function FileUtils.GetPidOfRunningEnetHostByPort(self: FileUtils, server: any)
-> number?
eNet specific commands
GetRelativeDirectoryPathOfNoitaMP#
function FileUtils.GetRelativeDirectoryPathOfNoitaMP(self: FileUtils)
-> string
Returns the RELATIVE path of the mods folder.
@return — mods/noita-mp
GetRelativeDirectoryPathOfRequiredLibs#
function FileUtils.GetRelativeDirectoryPathOfRequiredLibs(self: FileUtils)
-> string
Returns the RELATIVE path of the library folder required for this mod.
@return — /mods/noita-mp/files/libs
GetRelativePathOfNoitaMpSettingsDirectory#
function FileUtils.GetRelativePathOfNoitaMpSettingsDirectory(self: FileUtils)
-> unknown
GetVersionByFile#
function FileUtils.GetVersionByFile(self: FileUtils)
-> version: string
Returns NoitaMP version by reading the .version file.
KillNoitaAndRestart#
function FileUtils.KillNoitaAndRestart(self: FileUtils)
KillProcess#
function FileUtils.KillProcess(self: FileUtils, pid: any)
MkDir#
function FileUtils.MkDir(self: FileUtils, full_path: string)
ReadBinaryFile#
function FileUtils.ReadBinaryFile(self: FileUtils, file_fullpath: string)
-> string|number
ReadFile#
function FileUtils.ReadFile(self: FileUtils, file_fullpath: string, mode?: string)
-> unknown
RemoveContentOfDirectory#
function FileUtils.RemoveContentOfDirectory(self: FileUtils, absolutePath: any)
RemoveTrailingPathSeparator#
function FileUtils.RemoveTrailingPathSeparator(self: FileUtils, path: string)
-> path: string
Removes trailing path separator in a string: \persistent\flags\ -> \persistent\flags. Error if path is not a string.
@param path
— any string, i.e. \persistent\flags\
@return path
— \persistent\flags
ReplacePathSeparator#
function FileUtils.ReplacePathSeparator(self: FileUtils, path: string)
-> path: string
2. count: number
Replaces windows path separator to unix path separator and vice versa. Error if path is not a string.
SaveAndRestartNoita#
function FileUtils.SaveAndRestartNoita(self: FileUtils)
This executes c code to sent SDL_QUIT command to the app
ScanDir#
function FileUtils.ScanDir(self: FileUtils, directory: any)
-> string[]
Lua implementation of PHP scandir function
SetAbsolutePathOfNoitaRootDirectory#
function FileUtils.SetAbsolutePathOfNoitaRootDirectory(self: FileUtils, noitaMpSettings: NoitaMpSettings|nil)
Sets root directory of noita.exe, i.e. C:\Program Files (x86)\Steam\steamapps\common\Noita
@param noitaMpSettings
— optional. Needed for saving Noitas root directory to settings file.
SplitPath#
function FileUtils.SplitPath(self: FileUtils, str: any)
-> unknown
http://lua-users.org/wiki/SplitJoin -> Example: Split a file path string into components.
WriteBinaryFile#
function FileUtils.WriteBinaryFile(self: FileUtils, file_fullpath: string, file_content: any)
WriteFile#
function FileUtils.WriteFile(self: FileUtils, file_fullpath: string, file_content: string)
customProfiler#
CustomProfiler
Simple profiler that can be used to measure the duration of a function and the memory usage of a function.
ffi#
unknown
json#
unknown
lfs#
unknown
logger#
Logger
new#
function FileUtils.new(self: FileUtils, fileUtilsObject: FileUtils|nil, customProfiler: CustomProfiler|nil, logger: Logger|nil, noitaMpSettings: NoitaMpSettings, plotly: plotly|nil, utils: Utils|nil)
-> FileUtils
FileUtils constructor.
@param fileUtilsObject
— require("FileUtils") or nil
@param customProfiler
— can be nil
@param logger
— can be nil
@param noitaMpSettings
— required
@param plotly
— can be nil
@param utils
— can be nil
utils#
Utils
Utils class for lazy developers.
watcher#
unknown
GameGetRealWorldTimeSinceStarted#
function _G.GameGetRealWorldTimeSinceStarted()
-> integer
GetWidthAndHeightByResolution#
Returns width and height depending on resolution. GuiGetScreenDimensions( gui:obj ) -> width:number,height:number [Returns dimensions of viewport in the gui coordinate system (which is equal to the coordinates of the screen bottom right corner in gui coordinates). The values returned may change depending on the game resolution because the UI is scaled for pixel-perfect text rendering.]
function GetWidthAndHeightByResolution()
-> width: number
2. height: number
GlobalsUtils#
client#
Client|nil
customProfiler#
CustomProfiler
Simple profiler that can be used to measure the duration of a function and the memory usage of a function.
getDeadNuids#
function GlobalsUtils.getDeadNuids(self: GlobalsUtils)
-> table
getNuidEntityPair#
function GlobalsUtils.getNuidEntityPair(self: GlobalsUtils, nuid: number)
-> nuid: number|nil
2. entityId: number|nil
Builds a key string by nuid and returns nuid and entityId found by the globals.
getUpdateGui#
function GlobalsUtils.getUpdateGui(self: GlobalsUtils)
-> unknown
logger#
Logger
new#
function GlobalsUtils.new(self: GlobalsUtils, globalsUtilsObject: GlobalsUtils|nil, customProfiler: CustomProfiler, logger: Logger, client: Client|nil, utils: Utils)
-> GlobalsUtils
Constructor of the class. This is mandatory!
@param globalsUtilsObject
— optional
@param customProfiler
— required
@param logger
— required
@param client
— optional
@param utils
— required
parseXmlValueToNuidAndEntityId#
function GlobalsUtils.parseXmlValueToNuidAndEntityId(self: GlobalsUtils, xmlKey: string, xmlValue: string)
-> nuid: number|nil
2. entityId: number|nil
Parses key and value string to nuid and entityId.
@param xmlKey
— self.nuidKeyFormat = "nuid = %s"
@param xmlValue
— self.nuidValueFormat = "entityId = %s"
removeDeadNuid#
function GlobalsUtils.removeDeadNuid(self: GlobalsUtils, nuid: any)
setDeadNuid#
function GlobalsUtils.setDeadNuid(self: GlobalsUtils, nuid: any)
setNuid#
function GlobalsUtils.setNuid(self: GlobalsUtils, nuid: any, entityId: any, componentIdForOwnerName: any, componentIdForOwnerGuid: any, componentIdForNuid: any)
setUpdateGui#
function GlobalsUtils.setUpdateGui(self: GlobalsUtils, bool: any)
-> unknown
utils#
Utils
Utils class for lazy developers.
Gui#
Everything regarding ImGui: Credits to @dextercd
checkShortcuts#
function Gui.checkShortcuts(self: Gui)
Function to check if the user pressed a shortcut.
client#
Client
See: Client
customProfiler#
CustomProfiler
See: CustomProfiler
drawAbout#
function Gui.drawAbout(self: Gui)
Function for drawing the about window.
drawFirstTime#
function Gui.drawFirstTime(self: Gui)
Function to draw the first time window.
drawMenuBar#
function Gui.drawMenuBar(self: Gui)
Function to draw the menu bar.
drawPlayMenu#
function Gui.drawPlayMenu(self: Gui)
Function to draw the play menu.
drawPlayerList#
function Gui.drawPlayerList(self: Gui)
Function for drawing the player list window.
drawSettings#
function Gui.drawSettings(self: Gui)
Function to draw the settings window.
fileUtils#
FileUtils
globalsUtils#
GlobalsUtils
guidUtils#
GuidUtils
See: GuidUtils
imGui#
unknown
See: ~ImGui~
isServer#
nil
minaUtils#
MinaUtils
See: MinaUtils
networkVscUtils#
NetworkVscUtils
NetworkVscUtils for getting and setting values in VariableStorageComponents of Noita-API
new#
function Gui.new(self: Gui, guiObject: Gui|nil, server: Server, client: Client, customProfiler: CustomProfiler|nil, guidUtils: GuidUtils|nil, minaUtils: MinaUtils|nil, noitaMpSettings: NoitaMpSettings|nil)
-> Gui
Gui constructor.
@param guiObject
— optional
@param server
— required
@param client
— required
@param customProfiler
— optional
@param guidUtils
— optional
@param minaUtils
— optional
@param noitaMpSettings
— optional
noitaMpSettings#
NoitaMpSettings
See: NoitaMpSettings
server#
Server
See: Server
setShowMissingSettings#
function Gui.setShowMissingSettings(self: Gui, show: boolean)
Setter for the 'showMissingSettings' attribute to show the user that the settings are missing.
setShowSettingsSaved#
function Gui.setShowSettingsSaved(self: Gui, show: boolean)
Setter for the 'showSettingsSaved' attribute to show the user that the settings were saved.
update#
function Gui.update(self: Gui)
Guis update function, called every frame.
utils#
Utils
See: Utils
GuidUtils#
GuidUtils is just for generating and validating GUIDs. Guids are used for identifying clients and servers.
addGuidToCache#
function GuidUtils.addGuidToCache(self: GuidUtils, guid: string)
Adds a guid to the cache.
@param guid
— required
customProfiler#
CustomProfiler
Simple profiler that can be used to measure the duration of a function and the memory usage of a function.
generateNewGuid#
function GuidUtils.generateNewGuid(self: GuidUtils, inUsedGuids: table|nil)
-> guid: string
Generates a pseudo GUID. Does not fulfil RFC standard! Should generate unique GUIDs, but repeats if there is a duplicate. Based on https://github.com/Tieske/uuid ! Formerly known as 'getGuid()'.
@param inUsedGuids
— list of already used GUIDs
getCachedGuids#
function GuidUtils.getCachedGuids(self: GuidUtils)
-> cached_guid: table
Returns the cached guids.
isPatternValid#
function GuidUtils.isPatternValid(self: GuidUtils, guid: string)
-> true: boolean
Validates a guid only on its pattern.
@param guid
— required
@return true
— if GUID-pattern matches
isUnique#
function GuidUtils.isUnique(self: GuidUtils, guid: string)
-> true: boolean
Validates if the given guid is unique or already generated.
@return true
— if GUID is unique.
logger#
Logger
new#
function GuidUtils.new(self: GuidUtils, guidUtilsObject: GuidUtils|nil, customProfiler: CustomProfiler, fileUtils: FileUtils|nil, logger: Logger|nil, plotly: plotly|nil, socket: socket|nil, utils: Utils|nil, winapi: winapi|nil)
-> GuidUtils
GuidUtils constructor.
@param guidUtilsObject
— optional
@param customProfiler
— required
@param fileUtils
— optional
@param logger
— optional
@param plotly
— optional
@param socket
— optional
@param utils
— optional
@param winapi
— optional
setGuid#
function GuidUtils.setGuid(self: GuidUtils, client: Client|nil, server: Server|nil, guid: string|nil)
Sets the guid of a client or the server.
@param client
— Either client
@param server
— or server must be set!
@param guid
— guid can be optional. If not set, a new guid will be generated and set.
socket#
socket
toNumber#
function GuidUtils.toNumber(self: GuidUtils, guid: any)
-> integer
utils#
Utils
Utils class for lazy developers.
uuid#
unknown
Health#
current#
number
max#
number
Logger#
customProfiler#
CustomProfiler
Simple profiler that can be used to measure the duration of a function and the memory usage of a function.
debug#
function Logger.debug(self: Logger, channel: any, formattedMessage: any)
-> boolean
info#
function Logger.info(self: Logger, channel: any, formattedMessage: any)
-> boolean
new#
function Logger.new(self: Logger, loggerObject: Logger|nil, noitaMpSettings: NoitaMpSettings)
-> Logger
Logger constructor.
@param noitaMpSettings
— required
noitaMpSettings#
NoitaMpSettings
NoitaMpSettings: Replacement for Noita ModSettings.
trace#
function Logger.trace(self: Logger, channel: any, formattedMessage: any)
-> boolean
warn#
function Logger.warn(self: Logger, channel: any, formattedMessage: any)
-> boolean
MAX_MEMORY_USAGE#
KB = 524,438 MB
integer
MinaUtils#
Util class for fetching information about local and remote minas.
customProfiler#
CustomProfiler
Simple profiler that can be used to measure the duration of a function and the memory usage of a function.
getAllMinas#
function MinaUtils.getAllMinas(self: MinaUtils, client: Client, server: Server)
-> table
Returns all minas.
@param client
— Either client or
@param server
— server object is required!
getLocalMinaEntityId#
function MinaUtils.getLocalMinaEntityId(self: MinaUtils)
-> localMinaEntityId: number|nil
Getter for local mina entity id. It also takes care of polymorphism!
@return localMinaEntityId
— or nil if not found/dead
getLocalMinaGuid#
function MinaUtils.getLocalMinaGuid(self: MinaUtils)
-> localMinaGuid: string
Getter for local mina guid. ~It also loads it from settings file.~
getLocalMinaName#
function MinaUtils.getLocalMinaName(self: MinaUtils)
-> localMinaName: string
Getter for local mina name. ~It also loads it from settings file.~
getLocalMinaNuid#
function MinaUtils.getLocalMinaNuid(self: MinaUtils)
-> nuid: number
Getter for local mina nuid. It also takes care of polymorphism!
@return nuid
— if not found/dead
globalsUtils#
GlobalsUtils
isLocalMinaPolymorphed#
function MinaUtils.isLocalMinaPolymorphed(self: MinaUtils)
-> isPolymorphed: boolean
2. entityId: number|nil
Checks if local mina is polymorphed. Returns true, entityId | false, nil
isRemoteMinae#
function MinaUtils.isRemoteMinae(self: MinaUtils, client: Client, server: Server, entityId: number)
-> true: boolean
TODO: Rework this by adding and updating entityId to Server.entityId and Client.entityId! Dont forget polymorphism! Checks if the entityId is a remote minae.
@param client
— Either client or
@param server
— server object is required!
@param entityId
— required
@return true
— if entityId is a remote minae, otherwise false
logger#
Logger
networkVscUtils#
NetworkVscUtils
NetworkVscUtils for getting and setting values in VariableStorageComponents of Noita-API
new#
function MinaUtils.new(self: MinaUtils, minaUtils: MinaUtils|nil, customProfiler: CustomProfiler, globalsUtils: GlobalsUtils, logger: Logger, networkVscUtils: NetworkVscUtils, noitaMpSettings: NoitaMpSettings, utils: Utils)
-> MinaUtils
Constructor for MinaUtils.
@param minaUtils
— optional
@param customProfiler
— required
@param globalsUtils
— required
@param logger
— required
@param networkVscUtils
— required
@param noitaMpSettings
— required
@param utils
— required
noitaMpSettings#
NoitaMpSettings
NoitaMpSettings: Replacement for Noita ModSettings.
setLocalMinaGuid#
function MinaUtils.setLocalMinaGuid(self: MinaUtils, guid: string)
Setter for local mina guid. It also saves it to settings file.
@param guid
— required
setLocalMinaName#
function MinaUtils.setLocalMinaName(self: MinaUtils, name: string)
Setter for local mina name. It also saves it to settings file.
@param name
— required
utils#
Utils
Utils class for lazy developers.
ModGetActiveModIDs#
function _G.ModGetActiveModIDs()
-> table
ModIsEnabled#
function _G.ModIsEnabled(id: any)
-> boolean
ModSettingGet#
function _G.ModSettingGet(id: any)
-> table
ModSettingGetNextValue#
function _G.ModSettingGetNextValue(id: any)
-> boolean
NetworkCache#
clear#
function NetworkCache.clear(self: NetworkCache, clientCacheId: number)
-> unknown
Clears the cache entry for the given clientCacheId.
customProfiler#
any
Simple profiler that can be used to measure the duration of a function and the memory usage of a function.
get#
function NetworkCache.get(self: NetworkCache, clientCacheId: number, event: string, networkMessageId: number)
-> entry: table|nil
Gets the cache entry for the given clientCacheId, event and networkMessageId.
@return entry
— self.cache[clientCacheId][networkMessageId] or nil if not found
getAll#
function NetworkCache.getAll(self: NetworkCache)
-> self.cache: table
Returns all cache entries.
getChecksum#
function NetworkCache.getChecksum(self: NetworkCache, clientCacheId: number, dataChecksum: string)
-> entry: table|nil
Gets the checksum of a cache entry for the given clientCacheId and dataChecksum.
@return entry
— self.cache[clientCacheId][index] or nil if not found
logger#
any
new#
function NetworkCache.new(self: NetworkCache, customProfiler: any, logger: any, utils: any)
-> NetworkCache
removeOldest#
function NetworkCache.removeOldest(self: NetworkCache)
set#
function NetworkCache.set(self: NetworkCache, clientCacheId: number, networkMessageId: number, event: string, status: string, ackedAt?: any, sendAt?: any, dataChecksum: string)
Sets the cache entry for the given clientCacheId, networkMessageId and event.
size#
function NetworkCache.size(self: NetworkCache)
-> size: number
Returns the size of the cache.
usage#
function NetworkCache.usage(self: NetworkCache)
-> unknown
Returns the usage of the cache.
utils#
any
Utils class for lazy developers.
NetworkCacheUtils#
ack#
function NetworkCacheUtils.ack(self: NetworkCacheUtils, peerGuid: string, networkMessageId: number, event: string, status: string, ackedAt?: any, sendAt?: any, checksum: string)
Sets a acknoledgement for a cached network message.
customProfiler#
CustomProfiler
Simple profiler that can be used to measure the duration of a function and the memory usage of a function.
get#
function NetworkCacheUtils.get(self: NetworkCacheUtils, peerGuid: string, networkMessageId: number, event: string)
-> data: table|nil
Returns the cached network message.
@return data
— { ackedAt, dataChecksum, event, messageId, sendAt, status}
getByChecksum#
function NetworkCacheUtils.getByChecksum(self: NetworkCacheUtils, peerGuid: string, event: string, data: table)
-> cacheData: table|nil
Returns the cached network message by checksum.
@return cacheData
— { ackedAt, dataChecksum, event, messageId, sendAt, status}
getSum#
function NetworkCacheUtils.getSum(self: NetworkCacheUtils, event: string, data: table)
-> unknown
Returns the sum of the data.
guidUtils#
GuidUtils
GuidUtils is just for generating and validating GUIDs. Guids are used for identifying clients and servers.
logAll#
function NetworkCacheUtils.logAll(self: NetworkCacheUtils)
Logs all cached network messages. Only for debugging.
logger#
Logger
md5#
md5
networkCache#
NetworkCache
networkUtils#
NetworkUtils
new#
function NetworkCacheUtils.new(self: NetworkCacheUtils, customProfiler: CustomProfiler, guidUtils: GuidUtils, logger: Logger, md5: md5|nil, networkCache: NetworkCache, networkUtils: NetworkUtils|nil, utils: Utils|nil)
-> NetworkCacheUtils
NetworkCacheUtils constructor.
@param customProfiler
— required
@param guidUtils
— required
@param logger
— required
@param md5
— optional
@param networkCache
— required
@param networkUtils
— optional
@param utils
— optional
set#
function NetworkCacheUtils.set(self: NetworkCacheUtils, peerGuid: string, networkMessageId: number, event: any, status: any, ackedAt: any, sendAt: any, data: any)
-> string
Creates a new network cache entry.
@param peerGuid
— peer.guid
utils#
Utils
Utils class for lazy developers.
NetworkUtils#
alreadySent#
function NetworkUtils.alreadySent(self: NetworkUtils, peer: table, event: string, data: table)
-> boolean
Checks if the event within its data was already sent
@param peer
— If Server, then it's the peer, if Client, then it's the 'self' object
checkSchemaOrder#
function NetworkUtils.checkSchemaOrder(self: NetworkUtils, event: string, data: table)
Double checks if the schema order is correct, but only in dev build.
customProfiler#
CustomProfiler
Simple profiler that can be used to measure the duration of a function and the memory usage of a function.
deserialize#
function NetworkUtils.deserialize(self: NetworkUtils, value: any)
-> unknown
Default enhanced serialization function
getNextNetworkMessageId#
function NetworkUtils.getNextNetworkMessageId(self: NetworkUtils)
-> networkMessageIdCounter: integer
Returns the network message id counter and increases it by one
guidUtils#
GuidUtils
GuidUtils is just for generating and validating GUIDs. Guids are used for identifying clients and servers.
isTick#
function NetworkUtils.isTick(self: NetworkUtils)
-> boolean
Checks if the current time is a tick.
logger#
Logger
messagePack#
unknown
networkCacheUtils#
NetworkCacheUtils
new#
function NetworkUtils.new(self: NetworkUtils, customProfiler: CustomProfiler, guidUtils: GuidUtils, logger: Logger, networkCacheUtils: NetworkCacheUtils, utils: Utils|nil)
-> NetworkUtils
Constructor for NetworkUtils class.
serialize#
function NetworkUtils.serialize(self: NetworkUtils, value: any)
-> unknown
Default enhanced serialization function
utils#
Utils
Utils class for lazy developers.
zipTable#
function NetworkUtils.zipTable(self: NetworkUtils, items: table, keys: table, event: string)
-> table
links variables to keys based on their order note that it only works for boolean and number values, not strings. Credits to sock.lua
@param items
— data
@param keys
— schema
zstandard#
unknown
NetworkVscUtils#
NetworkVscUtils for getting and setting values in VariableStorageComponents of Noita-API
addOrUpdateAllVscs#
function NetworkVscUtils.addOrUpdateAllVscs(self: NetworkVscUtils, entityId: number, ownerName: string, ownerGuid: string, nuid: number|nil, spawnX: number|nil, spawnY: number|nil)
-> componentIdForOwnerName: integer|nil
2. componentIdForOwnerGuid: integer|nil
3. componentIdForNuid: integer|nil
4. componentIdForNuidDebugger: integer|nil
5. componentIdForNuidDebugger: integer|nil
6. componentIdForSpawnX: integer|nil
7. componentIdForSpawnY: integer|nil
Simply adds or updates all needed Network Variable Storage Components.
@param entityId
— Id of an entity provided by Noita
@param ownerName
— Owners name. Cannot be nil.
@param ownerGuid
— Owners guid. Cannot be nil.
@param nuid
— Network unique identifier. Can only be nil on clients, but not on server.
@param spawnX
— X position of the entity, when spawned. Can only be set once! Can be nil.
@param spawnY
— Y position of the entity, when spawned. Can only be set once! Can be nil.
checkIfSpecificVscExists#
function NetworkVscUtils.checkIfSpecificVscExists(self: NetworkVscUtils, entityId: number, componentTypeName: string, fieldNameForMatch: string, matchValue: string, fieldNameForValue: string)
-> compId: number|false|nil
2. value: string|nil
Checks if an entity already has a specific VariableStorageComponent.
@param entityId
— Id of an entity provided by Noita
@param componentTypeName
— "VariableStorageComponent", "LuaComponent", etc
@param fieldNameForMatch
— Components attribute to match the specific component you are searching for: "name", "script_source_file", "etc". component.name = "brah": 'name' -> fieldNameForMatch
@param matchValue
— The components attribute value, you want to match to: component.name = "brah": 'brah' -> matchValue Have a look on NetworkVscUtils.componentNameOf___
@param fieldNameForValue
— name
@return compId
— The specific componentId, which contains the searched value or false if there isn't any Component
@return value
— The components value
compId:
| false
customProfiler#
any
See: CustomProfiler
getAllVcsValuesByComponentIds#
function NetworkVscUtils.getAllVcsValuesByComponentIds(self: NetworkVscUtils, ownerNameCompId: number, ownerGuidCompId: number, nuidCompId: number)
-> ownerName: string
2. ownerGuid: string
3. nuid: number
Returns all Network Vsc values by its component ids.
@param ownerNameCompId
— Component Id of the OwnerNameVsc
@param ownerGuidCompId
— Component Id of the OwnerGuidVsc
@param nuidCompId
— Component Id of the NuidVsc
getAllVscValuesByEntityId#
function NetworkVscUtils.getAllVscValuesByEntityId(self: NetworkVscUtils, entityId: number)
-> ownerName: string?
2. ownerGuid: string?
3. nuid: number?
Returns all Network Vsc values by its entity id.
@param entityId
— Entity Id provided by Noita
@return ownerName,ownerGuid,nuid
— - nuid can be nil
globalsUtils#
any
See: GlobalsUtils
hasNetworkLuaComponents#
function NetworkVscUtils.hasNetworkLuaComponents(self: NetworkVscUtils, entityId: any)
-> boolean|nil
hasNuidSet#
function NetworkVscUtils.hasNuidSet(self: NetworkVscUtils, entityId: number)
-> has: boolean
2. nuid: number|nil
Checks if the nuid Vsc exists, if so returns nuid
@return has
— retruns 'false, -1': Returns false, if there is no NuidVsc or nuid is empty.
@return nuid
— Returns 'true, nuid', if set.
isNetworkEntityByNuidVsc#
function NetworkVscUtils.isNetworkEntityByNuidVsc(self: NetworkVscUtils, entityId: number)
-> isNetworkEntity: boolean
2. componentId: number
3. nuid: number|nil
Returns true, componentId and nuid if the entity has a NetworkVsc.
@param entityId
— entityId provided by Noita
logger#
any
See: Logger
new#
function NetworkVscUtils.new(self: NetworkVscUtils, networkVscUtilsObject: any, customProfiler: any, logger: any, server: any, globalsUtils: any, utils: any)
-> NetworkVscUtils
server#
any
See: Server
utils#
any
See: Utils
NoitaComponentUtils#
Class for using Noita components.
addOrGetNetworkSpriteStatusIndicator#
function NoitaComponentUtils.addOrGetNetworkSpriteStatusIndicator(self: NoitaComponentUtils, entityId: number)
-> compId: number|nil
Adds a SpriteComponent to indicate network status visually.
customProfiler#
CustomProfiler
Simple profiler that can be used to measure the duration of a function and the memory usage of a function.
getEntityData#
function NoitaComponentUtils.getEntityData(self: NoitaComponentUtils, entityId: number)
-> ownername: string
2. ownerguid: string
3. nuid: number
4. filename: string
5. health: Health
6. rotation: number
7. velocity: Vec2
8. x: number
9. y: number
Fetches data like position, rotation, velocity, health and filename
getEntityDataByNuid#
function NoitaComponentUtils.getEntityDataByNuid(self: NoitaComponentUtils, nuid: any)
-> string
2. string
3. number
4. string
5. Health
6. number
7. Vec2
8. number
9. number
getInitialSerializedEntityString#
function NoitaComponentUtils.getInitialSerializedEntityString(self: NoitaComponentUtils, entityId: number)
-> initSerializedB64Str: string|nil
Get initial serialized entity string to determine if the entity already exists on the server.
globalsUtils#
GlobalsUtils
hasInitialSerializedEntityString#
function NoitaComponentUtils.hasInitialSerializedEntityString(self: NoitaComponentUtils, entityId: any)
-> boolean
logger#
Logger
networkVscUtils#
NetworkVscUtils
NetworkVscUtils for getting and setting values in VariableStorageComponents of Noita-API
new#
function NoitaComponentUtils.new(self: NoitaComponentUtils, noitaComponentUtilsObject: NoitaComponentUtils|nil, customProfiler: CustomProfiler, globalsUtils: GlobalsUtils, logger: Logger|nil, networkVscUtils: NetworkVscUtils|nil, utils: Utils|nil, noitaPatcherUtils: NoitaPatcherUtils)
-> NoitaComponentUtils
NoitaComponentUtils constructor.
@param noitaComponentUtilsObject
— optional
@param customProfiler
— required
@param globalsUtils
— required
@param logger
— optional
@param networkVscUtils
— optional
@param utils
— optional
@param noitaPatcherUtils
— required
noitaPatcherUtils#
NoitaPatcherUtils
setEntityData#
function NoitaComponentUtils.setEntityData(self: NoitaComponentUtils, entityId: number, x: number, y: number, rotation: number, velocity?: Vec2, health: number)
setInitialSerializedEntityString#
function NoitaComponentUtils.setInitialSerializedEntityString(self: NoitaComponentUtils, entityId: number, initSerializedB64Str: string)
-> if: boolean
Set initial serialized entity string to determine if the entity already exists on the server.
@return if
— success
setNetworkSpriteIndicatorStatus#
function NoitaComponentUtils.setNetworkSpriteIndicatorStatus(self: NoitaComponentUtils, entityId: number, status: string)
Sets the SpriteComponent to a specific status by setting image_file.
@param status
— off, processed, serialised, sent, acked
utils#
Utils
Utils class for lazy developers.
NoitaMpSettings#
NoitaMpSettings: Replacement for Noita ModSettings.
clearAndCreateSettings#
function NoitaMpSettings.clearAndCreateSettings(self: NoitaMpSettings)
Removes all settings and creates a new settings file.
customProfiler#
CustomProfiler
See: CustomProfiler
fileUtils#
FileUtils
get#
function NoitaMpSettings.get(self: NoitaMpSettings, key: string, dataType: string)
-> value: boolean|string|number|nil
Returns a setting from the settings file converted to the given dataType. If the setting does not exist, it will be created with the default empty value.
@param key
— required
@param dataType
— required! Must be one of "boolean" or "number". If not set, "string" is default.
@return value
— converted to dataType or nil, when value is not set.
gui#
Gui
Everything regarding ImGui: Credits to @dextercd
isMoreThanOneNoitaProcessRunning#
function NoitaMpSettings.isMoreThanOneNoitaProcessRunning(self: NoitaMpSettings)
-> true: boolean
Checks if more than one Noita process is running.
@return true
— if more than one Noita process is running.
json#
json
lfs#
LuaFileSystem
load#
function NoitaMpSettings.load(self: NoitaMpSettings)
Loads the settings from the settings file and put those into the cached settings.
logger#
Logger
new#
function NoitaMpSettings.new(self: NoitaMpSettings, noitaMpSettings: NoitaMpSettings|nil, customProfiler: CustomProfiler|nil, gui: Gui, fileUtils: FileUtils|nil, json: json|nil, lfs: LuaFileSystem|nil, logger: Logger|nil, utils: Utils|nil, winapi: winapi|nil)
-> NoitaMpSettings
NoitaMpSettings constructor.
@param gui
— required
save#
function NoitaMpSettings.save(self: NoitaMpSettings)
set#
function NoitaMpSettings.set(self: NoitaMpSettings, key: string, value: any)
-> self.cachedSettings: table
Sets a setting. Saves the settings to the settings file and returns the new updated cached settings.
@param key
— required
@param value
— required
settingsFileExists#
unknown
utils#
Utils
Utils class for lazy developers.
winapi#
winapi
NoitaPatcherUtils#
base64#
unknown
customProfiler#
CustomProfiler
Simple profiler that can be used to measure the duration of a function and the memory usage of a function.
deserializeEntity#
function NoitaPatcherUtils.deserializeEntity(self: NoitaPatcherUtils, entityId: number, base64String: string, x: number|nil, y: number|nil)
-> entityId: number
Deserialize an entity from a serialized base64 string and create it at the given position.
@param entityId
— mostly an empty entity, but required
@param base64String
— serialized entity in base64 format
@param x
— x position to create entity at, but optional.
@param y
— y position to create entity at, but optional.
@return entityId
— of the created entity
luaNoitaMpNative#
unknown
new#
function NoitaPatcherUtils.new(self: NoitaPatcherUtils, customProfiler: CustomProfiler, np: noitapatcher)
-> NoitaPatcherUtils
NoitaPatcherUtils constructor.
@param customProfiler
— required
@param np
— required
np#
noitapatcher
serializeEntity#
function NoitaPatcherUtils.serializeEntity(self: NoitaPatcherUtils, entityId: number)
-> base64String: string
Serialize an entity to a base64 and md5 string.
@return base64String
— base64 encoded string
utils#
Utils
Utils class for lazy developers.
NuidUtils#
NuidUtils for getting the current network unique identifier
client#
Client
customProfiler#
CustomProfiler
Simple profiler that can be used to measure the duration of a function and the memory usage of a function.
fileUtils#
FileUtils
getEntityIdsByKillIndicator#
function NuidUtils.getEntityIdsByKillIndicator(self: NuidUtils)
-> table<number, number>
If an entity died, the associated nuid-entityId-set will be updated with entityId multiplied by -1. If this happens, KillEntityMsg has to be send by network.
getNextNuid#
function NuidUtils.getNextNuid(self: NuidUtils)
-> integer
globalUtils#
GlobalsUtils
logger#
Logger
new#
function NuidUtils.new(self: NuidUtils, nuidUitlsObject: NuidUtils|nil, client: Client, customProfiler: CustomProfiler, fileUtils: FileUtils|nil, globalsUtils: GlobalsUtils|nil, logger: Logger|nil, nxml: nxml|nil)
-> NuidUtils
NuidUtils constructor
@param nuidUitlsObject
— optional
@param client
— required
@param customProfiler
— required
@param fileUtils
— optional
@param globalsUtils
— optional
@param logger
— optional
@param nxml
— optional
nxml#
nxml
worldStateXmlFileExists#
unknown
OnProjectileFired#
Must define these callbacks else you get errors every time a projectile is fired. Functions are empty since we don't use these callbacks at the moment.
function OnProjectileFired()
OnProjectileFiredPost#
function OnProjectileFiredPost()
OnWorldInitialized#
function OnWorldInitialized()
PlayerNameFunction#
function PlayerNameFunction(entity_id: any, playerName: any)
Server#
__index#
Server
acknowledgeMaxSize#
integer
address#
string
amIServer#
function Server.amIServer(self: Server)
-> true: boolean
Checks if the current local user is a server.
@return true
— if server, false if not
See: Client.amIClient
ban#
function Server.ban(self: Server, name: string)
Bans a player by name.
@param name
— required
clients#
table
customProfiler#
CustomProfiler
Simple profiler that can be used to measure the duration of a function and the memory usage of a function.
defaultSendChannel#
integer
defaultSendMode#
string
deserialize#
nil
entityCache#
EntityCache
entityCacheUtils#
EntityCacheUtils
See: EntityCacheUtils
entityUtils#
EntityUtils
fileUtils#
FileUtils
See: FileUtils
getAckCacheSize#
function Server.getAckCacheSize(self: Server)
-> cacheSize: number
Mainly for profiling. Returns then network cache, aka acknowledge.
globalsUtils#
GlobalsUtils
See: GlobalsUtils
guid#
nil
guidUtils#
GuidUtils
See: GuidUtils
health#
table
host#
nil
iAm#
string
inBandwidth#
number
isRunning#
function Server.isRunning(self: Server)
-> true: boolean
Returns true if server is running, false if not.
@return true
— if server is running, false if not
TODO: remove this before merge
kick#
function Server.kick(self: Server, name: string)
Kicks a player by name.
@param name
— required
listener#
table
newListener(),
logger#
Logger
maxChannels#
number
maxPeers#
number
messageTimeout#
integer
minaUtils#
MinaUtils
Util class for fetching information about local and remote minas.
modListCached#
nil
name#
nil
networkCache#
NetworkCache
networkCacheUtils#
NetworkCacheUtils
networkUtils#
NetworkUtils
networkVscUtils#
NetworkVscUtils
NetworkVscUtils for getting and setting values in VariableStorageComponents of Noita-API
new#
function Server.new(address: string|nil, port: number|nil, maxPeers: number|nil, maxChannels: number|nil, inBandwidth: number|nil, outBandwidth: number|nil, np: noitapatcher)
-> Server
Server constructor. Inherits from SockServer sock.newServer.
@param address
— optional
@param port
— optional
@param maxPeers
— optional
@param maxChannels
— optional
@param inBandwidth
— optional
@param outBandwidth
— optional
@param np
— required
noitaComponentUtils#
NoitaComponentUtils
Class for using Noita components.
noitaMpSettings#
NoitaMpSettings
NoitaMpSettings: Replacement for Noita ModSettings.
noitaPatcherUtils#
NoitaPatcherUtils
nuid#
nil
nuidUtils#
NuidUtils
NuidUtils for getting the current network unique identifier
outBandwidth#
number
packetsReceived#
integer
packetsSent#
integer
peers#
table
port#
number
preStart#
function Server.preStart(self: Server, ip: string|nil, port: number|nil)
Starts a server on ip and port. Both can be nil, then ModSettings will be used.
@param ip
— localhost or 127.0.0.1 or nil
@param port
— port number from 1 to max of 65535 or nil
preUpdate#
function Server.preUpdate(self: Server, startFrameTime: number)
Updates the server by checking for network events and handling them.
@param startFrameTime
— required
See: ~SockServer.update~
send#
function Server.send(self: Server, peer: Client|Server, event: string, data: table)
-> true: boolean
Sends a message a one peer.
@param peer
— required
@param event
— required
@param data
— required
@return true
— if message was sent, false if not
sendChannel#
integer
sendDeadNuids#
function Server.sendDeadNuids(self: Server, deadNuids: table)
Sends dead nuids to all clients.
@param deadNuids
— required
sendEntityData#
function Server.sendEntityData(self: Server, entityId: number)
Sends entity data to all clients.
@param entityId
— required
sendMinaInformation#
function Server.sendMinaInformation(self: Server)
-> boolean
Sends mina information to all clients.
sendMode#
string
sendNewGuid#
function Server.sendNewGuid(self: Server, peer: Client|Server, oldGuid: string, newGuid: string)
-> true: boolean
Sends a message to the client, when there is a guid clash.
@return true
— if message was sent, false if not
sendNewNuid#
function Server.sendNewNuid(self: Server, ownerName: string, ownerGuid: string, entityId: number, currentSerializedB64Str: string, nuid: number, x: number, y: number, initSerializedB64Str: string)
-> true: boolean
Sends a new nuid to all clients. This also creates/updates the entities on clients.
@param ownerName
— required
@param ownerGuid
— required
@param entityId
— required
@param currentSerializedB64Str
— required
@param nuid
— required
@param x
— required
@param y
— required
@param initSerializedB64Str
— required
@return true
— if message was sent, false if not
sendToAll#
function Server.sendToAll(self: Server, event: string, data: table)
-> true: boolean
Sends a message to all peers.
@param event
— required
@param data
— required
@return true
— if message was sent, false if not
sendToAllBut#
function Server.sendToAllBut(self: Server, peer: Client|Server, event: string, data: table)
-> true: boolean
Sends a message to all peers excluded one peer defined as the peer param.
@param peer
— required
@param event
— required
@param data
— required
@return true
— if message was sent, false if not
serialize#
nil
stop#
function Server.stop(self: Server)
Stops the server.
transform#
table
utils#
unknown
Utils class for lazy developers.
zipTable#
function
SockClient#
zipTable#
function
SockServer#
address#
string
clients#
table
defaultSendChannel#
integer
defaultSendMode#
string
deserialize#
nil
host#
nil
inBandwidth#
number
listener#
table
newListener(),
maxChannels#
number
maxPeers#
number
messageTimeout#
integer
outBandwidth#
number
packetsReceived#
integer
packetsSent#
integer
peers#
table
port#
number
sendChannel#
integer
sendMode#
string
serialize#
nil
zipTable#
function
Ui#
Ui: NoitaMP UI. See: * ~PlayerList.xml~ * ~FoldingMenu.xml~
table
Ui.new#
function Ui.new()
-> table
Utils#
Utils class for lazy developers.
copyToClipboard#
function Utils.copyToClipboard(self: Utils, copy: string)
Copies a string to the clipboard.
@param copy
— string to copy to the clipboard. required
ffi#
unknown
isEmpty#
function Utils.isEmpty(self: Utils, var: string|number|table|nil)
-> true: boolean
Checks if a variable is empty.
@param var
— variable to check
@return true
— if empty, false otherwise
new#
function Utils.new(self: Utils, utilsObject: any)
-> Utils
openUrl#
function Utils.openUrl(self: Utils, url: string)
Opens a url in the default browser.
@param url
— url to open. required
pformat#
function Utils.pformat(self: Utils, var: string|number|table|nil)
-> formatted: string|number|table
Formats anything pretty.
@param var
— variable to print
@return formatted
— variable
pprint#
unknown
reloadMap#
function Utils.reloadMap(self: Utils, seed: number)
Reloads the whole world with a specific seed. No need to restart the game and use magic numbers.
@param seed
— max = 4294967295
sleep#
function Utils.sleep(self: Utils, s: number)
Wait for n seconds.
@param s
— seconds to wait. required
wait#
function Utils.wait(self: Utils, s: number)
Wait for n seconds.
@param s
— seconds to wait
See: Utils.sleep
_G#
A global variable (not a function) that holds the global environment (see §2.2). Lua itself does not use this variable; changing its value does not affect any environment, nor vice versa.
_G
_VERSION#
A global variable (not a function) that holds a string containing the running Lua version.
string
__genOrderedIndex#
function __genOrderedIndex(t: any)
-> table
arg#
Command-line arguments of Lua Standalone.
string[]
assert#
Raises an error if the value of its argument v is false (i.e., nil
or false
); otherwise, returns all its arguments. In case of error, message
is the error object; when absent, it defaults to "assertion failed!"
function assert(v?: <T>, message?: any, ...any)
-> <T>
2. ...any
client#
Client
collectgarbage#
This function is a generic interface to the garbage collector. It performs different functions according to its first argument, opt
.
opt:
-> "collect" -- Performs a full garbage-collection cycle.
| "stop" -- Stops automatic execution.
| "restart" -- Restarts automatic execution.
| "count" -- Returns the total memory in Kbytes.
| "step" -- Performs a garbage-collection step.
| "isrunning" -- Returns whether the collector is running.
| "incremental" -- Change the collector mode to incremental.
| "generational" -- Change the collector mode to generational.
function collectgarbage(opt?: "collect"|"count"|"generational"|"incremental"|"isrunning"...(+3), ...any)
-> any
compId#
unknown
unknown
coroutine#
coroutinelib
coroutine.close#
Closes coroutine co
, closing all its pending to-be-closed variables and putting the coroutine in a dead state.
function coroutine.close(co: thread)
-> noerror: boolean
2. errorobject: any
coroutine.create#
Creates a new coroutine, with body f
. f
must be a function. Returns this new coroutine, an object with type "thread"
.
function coroutine.create(f: fun(...any):...unknown)
-> thread
coroutine.isyieldable#
Returns true when the coroutine co
can yield. The default for co
is the running coroutine.
function coroutine.isyieldable(co?: thread)
-> boolean
coroutine.resume#
Starts or continues the execution of coroutine co
.
function coroutine.resume(co: thread, val1?: any, ...any)
-> success: boolean
2. ...any
coroutine.running#
Returns the running coroutine plus a boolean, true when the running coroutine is the main one.
function coroutine.running()
-> running: thread
2. ismain: boolean
coroutine.status#
Returns the status of coroutine co
.
return #1:
| "running" -- Is running.
| "suspended" -- Is suspended or not started.
| "normal" -- Is active but not running.
| "dead" -- Has finished or stopped with an error.
function coroutine.status(co: thread)
-> "dead"|"normal"|"running"|"suspended"
coroutine.wrap#
Creates a new coroutine, with body f
; f
must be a function. Returns a function that resumes the coroutine each time it is called.
function coroutine.wrap(f: fun(...any):...unknown)
-> fun(...any):...unknown
coroutine.yield#
Suspends the execution of the calling coroutine.
(async) function coroutine.yield(...any)
-> ...any
debug#
debuglib
debug.debug#
Enters an interactive mode with the user, running each string that the user enters.
function debug.debug()
debug.getfenv#
Returns the environment of object o
.
function debug.getfenv(o: any)
-> table
debug.gethook#
Returns the current hook settings of the thread.
function debug.gethook(co?: thread)
-> hook: function
2. mask: string
3. count: integer
debug.getinfo#
Returns a table with information about a function.
what:
+> "n" -- `name` and `namewhat`
+> "S" -- `source`, `short_src`, `linedefined`, `lastlinedefined`, and `what`
+> "l" -- `currentline`
+> "t" -- `istailcall`
+> "u" -- `nups`, `nparams`, and `isvararg`
+> "f" -- `func`
+> "r" -- `ftransfer` and `ntransfer`
+> "L" -- `activelines`
function debug.getinfo(thread: thread, f: integer|fun(...any):...unknown, what?: string|"L"|"S"|"f"|"l"...(+4))
-> debuginfo
debug.getlocal#
Returns the name and the value of the local variable with index local
of the function at level f
of the stack.
function debug.getlocal(thread: thread, f: integer|fun(...any):...unknown, index: integer)
-> name: string
2. value: any
debug.getmetatable#
Returns the metatable of the given value.
function debug.getmetatable(object: any)
-> metatable: table
debug.getregistry#
Returns the registry table.
function debug.getregistry()
-> table
debug.getupvalue#
Returns the name and the value of the upvalue with index up
of the function.
function debug.getupvalue(f: fun(...any):...unknown, up: integer)
-> name: string
2. value: any
debug.getuservalue#
Returns the n
-th user value associated
to the userdata u
plus a boolean,
false
if the userdata does not have that value.
function debug.getuservalue(u: userdata, n?: integer)
-> any
2. boolean
debug.setcstacklimit#
Deprecated in Lua 5.4.2
#
Sets a new limit for the C stack. This limit controls how deeply nested calls can go in Lua, with the intent of avoiding a stack overflow.
In case of success, this function returns the old limit. In case of error, it returns false
.
function debug.setcstacklimit(limit: integer)
-> boolean|integer
debug.setfenv#
Sets the environment of the given object
to the given table
.
function debug.setfenv(object: <T>, env: table)
-> object: <T>
debug.sethook#
Sets the given function as a hook.
mask:
+> "c" -- Calls hook when Lua calls a function.
+> "r" -- Calls hook when Lua returns from a function.
+> "l" -- Calls hook when Lua enters a new line of code.
function debug.sethook(thread: thread, hook: fun(...any):...unknown, mask: string|"c"|"l"|"r", count?: integer)
debug.setlocal#
Assigns the value
to the local variable with index local
of the function at level
of the stack.
function debug.setlocal(thread: thread, level: integer, index: integer, value: any)
-> name: string
debug.setmetatable#
Sets the metatable for the given value to the given table (which can be nil
).
function debug.setmetatable(value: <T>, meta?: table)
-> value: <T>
debug.setupvalue#
Assigns the value
to the upvalue with index up
of the function.
function debug.setupvalue(f: fun(...any):...unknown, up: integer, value: any)
-> name: string
debug.setuservalue#
Sets the given value
as
the n
-th user value associated to the given udata
.
udata
must be a full userdata.
function debug.setuservalue(udata: userdata, value: any, n?: integer)
-> udata: userdata
debug.traceback#
Returns a string with a traceback of the call stack. The optional message string is appended at the beginning of the traceback.
function debug.traceback(thread: thread, message?: any, level?: integer)
-> message: string
debug.upvalueid#
Returns a unique identifier (as a light userdata) for the upvalue numbered n
from the given function.
function debug.upvalueid(f: fun(...any):...unknown, n: integer)
-> id: lightuserdata
debug.upvaluejoin#
Make the n1
-th upvalue of the Lua closure f1
refer to the n2
-th upvalue of the Lua closure f2
.
function debug.upvaluejoin(f1: fun(...any):...unknown, n1: integer, f2: fun(...any):...unknown, n2: integer)
dofile#
Opens the named file and executes its content as a Lua chunk. When called without arguments, dofile
executes the content of the standard input (stdin
). Returns all values returned by the chunk. In case of errors, dofile
propagates the error to its caller. (That is, dofile
does not run in protected mode.)
function dofile(filename?: string)
-> ...any
function dofile(path: any)
-> unknown
err#
unknown
error#
Terminates the last protected function called and returns message as the error object.
Usually, error
adds some information about the error position at the beginning of the message, if the message is a string.
function error(message: any, level?: integer)
executed#
boolean
getfenv#
Returns the current environment in use by the function. f
can be a Lua function or a number that specifies the function at that stack level.
function getfenv(f?: integer|fun(...any):...unknown)
-> table
getmetatable#
If object does not have a metatable, returns nil. Otherwise, if the object's metatable has a __metatable field, returns the associated value. Otherwise, returns the metatable of the given object.
function getmetatable(object: any)
-> metatable: table
globalsUtils#
GlobalsUtils
GlobalsUtils
GlobalsUtils
gui#
unknown
unknown
unknown
unknown
unknown
unknown
io#
iolib
io.close#
Close file
or default output file.
exitcode:
| "exit"
| "signal"
function io.close(file?: file*)
-> suc: boolean?
2. exitcode: ("exit"|"signal")?
3. code: integer?
io.flush#
Saves any written data to default output file.
function io.flush()
io.input#
Sets file
as the default input file.
function io.input(file: string|file*)
io.lines#
for c in io.lines(filename, ...) do
body
end
...(param):
| "n" -- Reads a numeral and returns it as number.
| "a" -- Reads the whole file.
-> "l" -- Reads the next line skipping the end of line.
| "L" -- Reads the next line keeping the end of line.
function io.lines(filename?: string, ...string|integer|"L"|"a"|"l"...(+1))
-> fun():any, ...unknown
io.open#
Opens a file, in the mode specified in the string mode
.
mode:
-> "r" -- Read mode.
| "w" -- Write mode.
| "a" -- Append mode.
| "r+" -- Update mode, all previous data is preserved.
| "w+" -- Update mode, all previous data is erased.
| "a+" -- Append update mode, previous data is preserved, writing is only allowed at the end of file.
| "rb" -- Read mode. (in binary mode.)
| "wb" -- Write mode. (in binary mode.)
| "ab" -- Append mode. (in binary mode.)
| "r+b" -- Update mode, all previous data is preserved. (in binary mode.)
| "w+b" -- Update mode, all previous data is erased. (in binary mode.)
| "a+b" -- Append update mode, previous data is preserved, writing is only allowed at the end of file. (in binary mode.)
function io.open(filename: string, mode?: "a"|"a+"|"a+b"|"ab"|"r"...(+7))
-> file*?
2. errmsg: string?
io.output#
Sets file
as the default output file.
function io.output(file: string|file*)
io.popen#
Starts program prog in a separated process.
mode:
| "r" -- Read data from this program by `file`.
| "w" -- Write data to this program by `file`.
function io.popen(prog: string, mode?: "r"|"w")
-> file*?
2. errmsg: string?
function io.popen(commandLine: any)
-> table|nil
io.read#
Reads the file
, according to the given formats, which specify what to read.
...(param):
| "n" -- Reads a numeral and returns it as number.
| "a" -- Reads the whole file.
-> "l" -- Reads the next line skipping the end of line.
| "L" -- Reads the next line keeping the end of line.
function io.read(...string|integer|"L"|"a"|"l"...(+1))
-> any
2. ...any
io.tmpfile#
In case of success, returns a handle for a temporary file.
function io.tmpfile()
-> file*
io.type#
Checks whether obj
is a valid file handle.
return #1:
| "file" -- Is an open file handle.
| "closed file" -- Is a closed file handle.
| `nil` -- Is not a file handle.
function io.type(file: file*)
-> "closed file"|"file"|`nil`
io.write#
Writes the value of each of its arguments to default output file.
function io.write(...any)
-> file*
2. errmsg: string?
ipairs#
Returns three values (an iterator function, the table t
, and 0
) so that the construction
for i,v in ipairs(t) do body end
will iterate over the key–value pairs (1,t[1]), (2,t[2]), ...
, up to the first absent index.
function ipairs(t: <T:table>)
-> fun(table: <V>[], i?: integer):integer, <V>
2. <T:table>
3. i: integer
is_linux#
boolean
boolean
boolean
is_windows#
NoitaMP additions
boolean
boolean
boolean
lldebugger#
TODO: remove this before merge TODO: remove this before merge
unknown
load#
Loads a chunk.
If chunk
is a string, the chunk is this string. If chunk
is a function, load
calls it repeatedly to get the chunk pieces. Each call to chunk
must return a string that concatenates with previous results. A return of an empty string, nil
, or no value signals the end of the chunk.
mode:
| "b" -- Only binary chunks.
| "t" -- Only text chunks.
-> "bt" -- Both binary and text.
function load(chunk: string|function, chunkname?: string, mode?: "b"|"bt"|"t", env?: table)
-> function?
2. error_message: string?
loadfile#
Loads a chunk from file filename
or from the standard input, if no file name is given.
mode:
| "b" -- Only binary chunks.
| "t" -- Only text chunks.
-> "bt" -- Both binary and text.
function loadfile(filename?: string, mode?: "b"|"bt"|"t", env?: table)
-> function?
2. error_message: string?
loadstring#
Loads a chunk from the given string.
function loadstring(text: string, chunkname?: string)
-> function?
2. error_message: string?
logger#
Logger
Logger
Logger
math#
mathlib
math.abs#
Returns the absolute value of x
.
function math.abs(x: <Number:number>)
-> <Number:number>
math.acos#
Returns the arc cosine of x
(in radians).
function math.acos(x: number)
-> number
math.asin#
Returns the arc sine of x
(in radians).
function math.asin(x: number)
-> number
math.atan#
Returns the arc tangent of y/x
(in radians).
function math.atan(y: number, x?: number)
-> number
math.atan2#
Returns the arc tangent of y/x
(in radians).
function math.atan2(y: number, x: number)
-> number
math.ceil#
Returns the smallest integral value larger than or equal to x
.
function math.ceil(x: number)
-> integer
math.cos#
Returns the cosine of x
(assumed to be in radians).
function math.cos(x: number)
-> number
math.cosh#
Returns the hyperbolic cosine of x
(assumed to be in radians).
function math.cosh(x: number)
-> number
math.deg#
Converts the angle x
from radians to degrees.
function math.deg(x: number)
-> number
math.exp#
Returns the value e^x
(where e
is the base of natural logarithms).
function math.exp(x: number)
-> number
math.floor#
Returns the largest integral value smaller than or equal to x
.
function math.floor(x: number)
-> integer
math.fmod#
Returns the remainder of the division of x
by y
that rounds the quotient towards zero.
function math.fmod(x: number, y: number)
-> number
math.frexp#
Decompose x
into tails and exponents. Returns m
and e
such that x = m * (2 ^ e)
, e
is an integer and the absolute value of m
is in the range [0.5, 1) (or zero when x
is zero).
function math.frexp(x: number)
-> m: number
2. e: number
math.ldexp#
Returns m * (2 ^ e)
.
function math.ldexp(m: number, e: number)
-> number
math.log#
Returns the logarithm of x
in the given base.
function math.log(x: number, base?: integer)
-> number
math.log10#
Returns the base-10 logarithm of x.
function math.log10(x: number)
-> number
math.max#
Returns the argument with the maximum value, according to the Lua operator <
.
function math.max(x: <Number:number>, ...<Number:number>)
-> <Number:number>
math.min#
Returns the argument with the minimum value, according to the Lua operator <
.
function math.min(x: <Number:number>, ...<Number:number>)
-> <Number:number>
math.modf#
Returns the integral part of x
and the fractional part of x
.
function math.modf(x: number)
-> integer
2. number
math.pow#
Returns x ^ y
.
function math.pow(x: number, y: number)
-> number
math.rad#
Converts the angle x
from degrees to radians.
function math.rad(x: number)
-> number
math.random#
math.random()
: Returns a float in the range [0,1).math.random(n)
: Returns a integer in the range [1, n].math.random(m, n)
: Returns a integer in the range [m, n].
function math.random(m: integer, n: integer)
-> integer
math.randomseed#
math.randomseed(x, y)
: Concatenatex
andy
into a 128-bitseed
to reinitialize the pseudo-random generator.math.randomseed(x)
: Equate tomath.randomseed(x, 0)
.math.randomseed()
: Generates a seed with a weak attempt for randomness.
function math.randomseed(x?: integer, y?: integer)
math.round#
This way, you can round on any bracket: math.round(119.68, 6.4) -- 121.6 (= 19 * 6.4) It works for "number of decimals" too, with a rather visual representation: math.round(119.68, 0.01) -- 119.68 math.round(119.68, 0.1) -- 119.7 math.round(119.68) -- 120 math.round(119.68, 100) -- 100 math.round(119.68, 1000) -- 0
function math.round(v: number|nil, bracket: number|nil)
-> number
math.sign#
Returns the sign of a number.
function math.sign(v: number)
-> integer
math.sin#
Returns the sine of x
(assumed to be in radians).
function math.sin(x: number)
-> number
math.sinh#
Returns the hyperbolic sine of x
(assumed to be in radians).
function math.sinh(x: number)
-> number
math.sqrt#
Returns the square root of x
.
function math.sqrt(x: number)
-> number
math.tan#
Returns the tangent of x
(assumed to be in radians).
function math.tan(x: number)
-> number
math.tanh#
Returns the hyperbolic tangent of x
(assumed to be in radians).
function math.tanh(x: number)
-> number
math.tointeger#
If the value x
is convertible to an integer, returns that integer.
function math.tointeger(x: any)
-> integer?
math.type#
Returns "integer"
if x
is an integer, "float"
if it is a float, or nil
if x
is not a number.
return #1:
| "integer"
| "float"
| 'nil'
function math.type(x: any)
-> "float"|"integer"|'nil'
math.ult#
Returns true
if and only if m
is below n
when they are compared as unsigned integers.
function math.ult(m: integer, n: integer)
-> boolean
module#
Creates a module.
function module(name: string, ...any)
name#
nil
unknown
networkVscUtils#
NetworkVscUtils for getting and setting values in VariableStorageComponents of Noita-API
NetworkVscUtils
NetworkVscUtils
newproxy#
function newproxy(proxy: boolean|table|userdata)
-> userdata
next#
Allows a program to traverse all fields of a table. Its first argument is a table and its second argument is an index in this table. A call to next
returns the next index of the table and its associated value. When called with nil
as its second argument, next
returns an initial index and its associated value. When called with the last index, or with nil
in an empty table, next
returns nil
. If the second argument is absent, then it is interpreted as nil
. In particular, you can use next(t)
to check whether a table is empty.
The order in which the indices are enumerated is not specified, even for numeric indices. (To traverse a table in numerical order, use a numerical for
.)
The behavior of next
is undefined if, during the traversal, you assign any value to a non-existent field in the table. You may however modify existing fields. In particular, you may set existing fields to nil.
function next(table: table<<K>, <V>>, index?: <K>)
-> <K>?
2. <V>?
noitaComponentUtils#
Class for using Noita components.
NoitaComponentUtils
noitaMpSettings#
NoitaMpSettings: Replacement for Noita ModSettings.
NoitaMpSettings
NoitaMpSettings
NoitaMpSettings
noitaMpSettings.customProfiler#
table
table
table
once#
boolean
orderedNext#
function orderedNext(t: any, state: any)
-> unknown|nil
2. unknown|nil
orderedPairs#
function orderedPairs(t: any)
-> function
2. unknown
3. nil
os#
oslib
os.clock#
Returns an approximation of the amount in seconds of CPU time used by the program.
function os.clock()
-> number
os.date#
Returns a string or a table containing date and time, formatted according to the given string format
.
function os.date(format?: string, time?: integer)
-> string|osdate
os.difftime#
Returns the difference, in seconds, from time t1
to time t2
.
function os.difftime(t2: integer, t1: integer)
-> integer
os.execute#
Passes command
to be executed by an operating system shell.
exitcode:
| "exit"
| "signal"
function os.execute(command?: string)
-> suc: boolean?
2. exitcode: ("exit"|"signal")?
3. code: integer?
function os.execute(commandLine: any)
-> integer
os.exit#
Calls the ISO C function exit
to terminate the host program.
function os.exit(code?: boolean|integer, close?: boolean)
os.getenv#
Returns the value of the process environment variable varname
.
function os.getenv(varname: string)
-> string?
os.remove#
Deletes the file with the given name.
function os.remove(filename: string)
-> suc: boolean
2. errmsg: string?
os.rename#
Renames the file or directory named oldname
to newname
.
function os.rename(oldname: string, newname: string)
-> suc: boolean
2. errmsg: string?
os.setlocale#
Sets the current locale of the program.
category:
-> "all"
| "collate"
| "ctype"
| "monetary"
| "numeric"
| "time"
function os.setlocale(locale: string|nil, category?: "all"|"collate"|"ctype"|"monetary"|"numeric"...(+1))
-> localecategory: string
os.time#
Returns the current time when called without arguments, or a time representing the local date and time specified by the given table.
function os.time(date?: osdate)
-> integer
os.tmpname#
Returns a string with a file name that can be used for a temporary file.
function os.tmpname()
-> string
os_arch#
unknown
os_name#
string
package#
packagelib
package.config#
A string describing some compile-time configurations for packages.
string
package.cpath#
unknown
string
string
package.loaders#
A table used by require
to control how to load modules.
table
package.loadlib#
Dynamically links the host program with the C library libname
.
function package.loadlib(libname: string, funcname: string)
-> any
package.path#
[[ LuaRocks modules ]]--
unknown
unknown
unknown
unknown
unknown
unknown
unknown
string
string
string
package.searchers#
A table used by require
to control how to load modules.
table
package.searchpath#
Searches for the given name
in the given path
.
function package.searchpath(name: string, path: string, sep?: string, rep?: string)
-> filename: string?
2. errmsg: string?
package.seeall#
Sets a metatable for module
with its __index
field referring to the global environment, so that this module inherits values from the global environment. To be used as an option to function module
.
function package.seeall(module: table)
pairs#
If t
has a metamethod __pairs
, calls it with t as argument and returns the first three results from the call.
Otherwise, returns three values: the next function, the table t
, and nil
, so that the construction
for k,v in pairs(t) do body end
will iterate over all key–value pairs of table t
.
See function next for the caveats of modifying the table during its traversal.
function pairs(t: <T:table>)
-> fun(table: table<<K>, <V>>, index?: <K>):<K>, <V>
2. <T:table>
pathSeparator#
string
string
string
pcall#
Calls the function f
with the given arguments in protected mode. This means that any error inside f
is not propagated; instead, pcall
catches the error and returns a status code. Its first result is the status code (a boolean), which is true if the call succeeds without errors. In such case, pcall
also returns all results from the call, after this first result. In case of any error, pcall
returns false
plus the error object.
function pcall(f: fun(...any):...unknown, arg1?: any, ...any)
-> success: boolean
2. result: any
3. ...any
print#
Receives any number of arguments and prints their values to stdout
, converting each argument to a string following the same rules of tostring.
The function print is not intended for formatted output, but only as a quick way to show a value, for instance for debugging. For complete control over the output, use string.format and io.write.
function print(...any)
profilerIsRunning#
boolean
boolean
rawequal#
Checks whether v1 is equal to v2, without invoking the __eq
metamethod.
function rawequal(v1: any, v2: any)
-> boolean
rawget#
Gets the real value of table[index]
, without invoking the __index
metamethod.
function rawget(table: table, index: any)
-> any
rawlen#
Returns the length of the object v
, without invoking the __len
metamethod.
function rawlen(v: string|table)
-> len: integer
rawset#
Sets the real value of table[index]
to value
, without using the __newindex
metavalue. table
must be a table, index
any value different from nil
and NaN
, and value
any Lua value.
This function returns table
.
function rawset(table: table, index: any, value: any)
-> table
require#
Loads the given module, returns any value returned by the searcher(true
when nil
). Besides that value, also returns as a second result the loader data returned by the searcher, which indicates how require
found the module. (For instance, if the module came from a file, this loader data is the file path.)
function require(modname: string)
-> unknown
2. loaderdata: unknown
run_count#
https://github.com/dextercd/Noita-Component-Explorer/blob/main/component-explorer/entities/imgui_warning.lua
integer
unknown
select#
If index
is a number, returns all arguments after argument number index
; a negative number indexes from the end (-1
is the last argument). Otherwise, index
must be the string "#"
, and select
returns the total number of extra arguments it received.
index:
| "#"
function select(index: integer|"#", ...any)
-> any
server#
Server
setfenv#
Sets the environment to be used by the given function.
function setfenv(f: fun(...any):...integer|unknown, table: table)
-> function
setmetatable#
Sets the metatable for the given table. If metatable
is nil
, removes the metatable of the given table. If the original metatable has a __metatable
field, raises an error.
This function returns table
.
To change the metatable of other types from Lua code, you must use the debug library (§6.10).
function setmetatable(table: table, metatable?: table)
-> table
seven_zip#
string
sock#
CONNECTING_STATES#
table
States that represent the client connecting to a server.
CONNECTION_STATES#
table
All of the possible connection statuses for a client connection. @see SockClient:getState
DISCONNECTING_STATES#
table
States that represent the client disconnecting from a server.
SEND_MODES#
table
Valid modes for sending messages.
string#
stringlib
string.ExtendOrCutStringToLength#
@param var
— any string you want to extend or cut
Extends @var to the @length with @char. Example 1: "test", 6, " " = "test " | Example 2: "verylongstring", 5, " " = "veryl"
function string.ExtendOrCutStringToLength(var: string, length: number, char: any, makeItVisible?: boolean)
-> string
string.byte#
Returns the internal numeric codes of the characters s[i], s[i+1], ..., s[j]
.
function string.byte(s: string|number, i?: integer, j?: integer)
-> ...integer
string.char#
Returns a string with length equal to the number of arguments, in which each character has the internal numeric code equal to its corresponding argument.
function string.char(byte: integer, ...integer)
-> string
string.contains#
@param str
— String
@param pattern
— String, Char, Regex
@return found
— 'true' if found, else 'false'.
Contains on lower case
function string.contains(str: string, pattern: string)
-> found: boolean
function string.contains(str: string, pattern: string)
-> found: boolean
string.dump#
Returns a string containing a binary representation (a binary chunk) of the given function.
function string.dump(f: fun(...any):...unknown, strip?: boolean)
-> string
string.find#
Looks for the first match of pattern
(see §6.4.1) in the string.
@return start
@return end
@return ...
— captured
function string.find(s: string|number, pattern: string|number, init?: integer, plain?: boolean)
-> start: integer
2. end: integer
3. ...any
string.format#
Returns a formatted version of its variable number of arguments following the description given in its first argument.
function string.format(s: string|number, ...any)
-> string
string.gmatch#
Returns an iterator function that, each time it is called, returns the next captures from pattern
(see §6.4.1) over the string s.
As an example, the following loop will iterate over all the words from string s, printing one per line:
s =
"hello world from Lua"
for w in string.gmatch(s, "%a+") do
print(w)
end
function string.gmatch(s: string|number, pattern: string|number, init?: integer)
-> fun():string, ...unknown
string.gsub#
Returns a copy of s in which all (or the first n
, if given) occurrences of the pattern
(see §6.4.1) have been replaced by a replacement string specified by repl
.
function string.gsub(s: string|number, pattern: string|number, repl: string|number|function|table, n?: integer)
-> string
2. count: integer
string.len#
Returns its length.
function string.len(s: string|number)
-> integer
string.lower#
Returns a copy of this string with all uppercase letters changed to lowercase.
function string.lower(s: string|number)
-> string
string.match#
Looks for the first match of pattern
(see §6.4.1) in the string.
function string.match(s: string|number, pattern: string|number, init?: integer)
-> ...any
string.pack#
Returns a binary string containing the values v1
, v2
, etc. packed (that is, serialized in binary form) according to the format string fmt
(see §6.4.2) .
function string.pack(fmt: string, v1: string|number, v2: any, ...string|number)
-> binary: string
string.packsize#
Returns the size of a string resulting from string.pack
with the given format string fmt
(see §6.4.2) .
function string.packsize(fmt: string)
-> integer
string.rep#
Returns a string that is the concatenation of n
copies of the string s
separated by the string sep
.
function string.rep(s: string|number, n: integer, sep?: string|number)
-> string
string.reverse#
Returns a string that is the string s
reversed.
function string.reverse(s: string|number)
-> string
string.split#
http://lua-users.org/wiki/SplitJoin Function: Split a string with a pattern, Take Two Compatibility: Lua-5.1
function string.split(str: any, pat: any)
-> table
function string.split(str: any, pat: any)
-> table
string.sub#
Returns the substring of the string that starts at i
and continues until j
.
function string.sub(s: string|number, i: integer, j?: integer)
-> string
string.trim#
function string.trim(s: any)
-> string
function string.trim(s: any)
-> string
string.unpack#
Returns the values packed in string according to the format string fmt
(see §6.4.2) .
function string.unpack(fmt: string, s: string, pos?: integer)
-> ...any
2. offset: integer
string.upper#
Returns a copy of this string with all lowercase letters changed to uppercase.
function string.upper(s: string|number)
-> string
table#
tablelib
table.concat#
Given a list where all elements are strings or numbers, returns the string list[i]..sep..list[i+1] ··· sep..list[j]
.
function table.concat(list: table, sep?: string, i?: integer, j?: integer)
-> string
table.foreach#
Executes the given f over all elements of table. For each element, f is called with the index and respective value as arguments. If f returns a non-nil value, then the loop is broken, and this value is returned as the final value of foreach.
function table.foreach(list: any, callback: fun(key: string, value: any):<T>|nil)
-> <T>|nil
table.foreachi#
Executes the given f over the numerical indices of table. For each index, f is called with the index and respective value as arguments. Indices are visited in sequential order, from 1 to n, where n is the size of the table. If f returns a non-nil value, then the loop is broken and this value is returned as the result of foreachi.
function table.foreachi(list: any, callback: fun(key: string, value: any):<T>|nil)
-> <T>|nil
table.getn#
Returns the number of elements in the table. This function is equivalent to #list
.
function table.getn(list: <T>[])
-> integer
table.insert#
Inserts element value
at position pos
in list
.
function table.insert(list: table, pos: integer, value: any)
table.maxn#
Returns the largest positive numerical index of the given table, or zero if the table has no positive numerical indices.
function table.maxn(table: table)
-> integer
table.move#
Moves elements from table a1
to table a2
.
a2[t],··· =
a1[f],···,a1[e]
return a2
function table.move(a1: table, f: integer, e: integer, t: integer, a2?: table)
-> a2: table
table.pack#
Returns a new table with all arguments stored into keys 1
, 2
, etc. and with a field "n"
with the total number of arguments.
function table.pack(...any)
-> table
table.remove#
Removes from list
the element at position pos
, returning the value of the removed element.
function table.remove(list: table, pos?: integer)
-> any
table.sort#
Sorts list elements in a given order, in-place, from list[1]
to list[#list]
.
function table.sort(list: <T>[], comp?: fun(a: <T>, b: <T>):boolean)
table.unpack#
Returns the elements from the given list. This function is equivalent to
return list[i], list[i+1], ···, list[j]
By default, i
is 1
and j
is #list
.
function table.unpack(list: <T>[], i?: integer, j?: integer)
-> ...<T>
tablelib#
contains#
function tablelib.contains(tbl: table, key: any)
-> true: boolean
2. index: number
Return true, if the key is contained in the tbl. NOTE: Doesn't check for duplicates inside the table.
@param key
— Number(index) or String(name matching) for indexing the table.
@return true
— if indexing by key does not return nil
@return index
— also returns the index of the found key
containsAll#
function tablelib.containsAll(tbl: table, ...any)
-> true: boolean
https://gist.github.com/HoraceBury/9307117#file-tablelib-lua-L293-L313 Returns true if all the arg parameters are contained in the tbl.
@return true
— if all the values were in the table.
indexOf#
function tablelib.indexOf(tbl: any, value: any)
-> integer|nil
https://stackoverflow.com/a/52922737/3493998
insertAllButNotDuplicates#
function tablelib.insertAllButNotDuplicates(tbl1: table, tbl2: table)
Adds all values of tbl2 into tbl, but not duplicates.
insertIfNotExist#
function tablelib.insertIfNotExist(tbl: table, value: any)
Adds a value to a table, if this value doesn't exist in the table
isEmpty#
function tablelib.isEmpty(tbl: table)
-> true: boolean
Extension or expansion of the default lua table for checking if a table is empty.
@return true
— if table is empty.
join#
function tablelib.join(tbl: table, logger: Logger, utils: Utils)
-> Example: string
We need a simple and 'fast' way to convert a lua table into a string.
@param tbl
— { "Name", 2, 234, "string" }
@param logger
— required
@param utils
— required
@return Example
— tbl becomes "Name,2,234,string"
removeByTable#
function tablelib.removeByTable(tbl1: table, tbl2: table)
-> tbl1: table
Removes all values in tbl1 by the values of tbl2
@return tbl1
— returns tbl1 with remove values containing in tbl2
removeByValue#
function tablelib.removeByValue(tbl: any, value: any)
-> unknown
size#
function tablelib.size(tbl: any)
-> integer
toBoolean#
function toBoolean(value: any)
-> boolean
tonumber#
When called with no base
, tonumber
tries to convert its argument to a number. If the argument is already a number or a string convertible to a number, then tonumber
returns this number; otherwise, it returns fail
.
The conversion of strings can result in integers or floats, according to the lexical conventions of Lua (see §3.1). The string may have leading and trailing spaces and a sign.
function tonumber(e: any)
-> number?
tostring#
Receives a value of any type and converts it to a string in a human-readable format.
If the metatable of v
has a __tostring
field, then tostring
calls the corresponding value with v
as argument, and uses the result of the call as its result. Otherwise, if the metatable of v
has a __name
field with a string value, tostring
may use that string in its final result.
For complete control of how numbers are converted, use string.format.
function tostring(v: any)
-> string
type#
Returns the type of its only argument, coded as a string. The possible results of this function are "nil"
(a string, not the value nil
), "number"
, "string"
, "boolean"
, "table"
, "function"
, "thread"
, and "userdata"
.
type:
| "nil"
| "number"
| "string"
| "boolean"
| "table"
| "function"
| "thread"
| "userdata"
function type(v: any)
-> type: "boolean"|"function"|"nil"|"number"|"string"...(+3)
unpack#
Returns the elements from the given list
. This function is equivalent to
return list[i], list[i+1], ···, list[j]
function unpack(list: <T>[], i?: integer, j?: integer)
-> ...<T>
utf8#
utf8lib
utf8.char#
Receives zero or more integers, converts each one to its corresponding UTF-8 byte sequence and returns a string with the concatenation of all these sequences.
function utf8.char(code: integer, ...integer)
-> string
utf8.codepoint#
Returns the codepoints (as integers) from all characters in s
that start between byte position i
and j
(both included).
function utf8.codepoint(s: string, i?: integer, j?: integer, lax?: boolean)
-> code: integer
2. ...integer
utf8.codes#
Returns values so that the construction
for p, c in utf8.codes(s) do
body
end
will iterate over all UTF-8 characters in string s, with p being the position (in bytes) and c the code point of each character. It raises an error if it meets any invalid byte sequence.
function utf8.codes(s: string, lax?: boolean)
-> fun(s: string, p: integer):integer, integer
utf8.len#
Returns the number of UTF-8 characters in string s
that start between positions i
and j
(both inclusive).
function utf8.len(s: string, i?: integer, j?: integer, lax?: boolean)
-> integer?
2. errpos: integer?
utf8.offset#
Returns the position (in bytes) where the encoding of the n
-th character of s
(counting from position i
) starts.
function utf8.offset(s: string, n: integer, i?: integer)
-> p: integer
warn#
Emits a warning with a message composed by the concatenation of all its arguments (which should be strings).
function warn(message: string, ...any)
xpcall#
Calls function f
with the given arguments in protected mode with a new message handler.
function xpcall(f: fun(...any):...unknown, msgh: function, arg1?: any, ...any)
-> success: boolean
2. result: any
3. ...any