Noita Wiki
Advertisement
Modding Pages
Getting startedBasicsLua ScriptingData.wakUseful Tools
AudioEnemiesEnvironmentsPerksSpellsSpritesheetsMaterialsImage Emitters
Lua APIEnumsSpecial TagsList of all tagsUtility ScriptsSound EventsEnemy Information TableSpell and Perk IDs

This page gathers together everything from lua_api_documentation.txt, with possible notes made by the community.


Note: Return values wrapped in brackets, like {entity_id}, mean an array of entities. Pay special attention to this!

Hooks[]

Note, this list was created from a string dump of the game, and thus may not be accurate.

OnActionPlayed[]

OnBiomeConfigLoaded[]

OnComponentAddedToEntity[]

OnComponentRemovingFromEntity[]

OnCountSecrets[]

OnJoystickConnected[]

OnJoystickDisconnected[]

OnMagicNumbersAndWorldSeedInitialized[]

OnModInit[]

OnModPostInit[]

OnModPreInit[]

OnModSettingsChanged[]

OnNotEnoughManaForAction[]

OnPausePreUpdate[]

OnPausedChanged[]

OnPlayerDied[]

OnPlayerSpawned[]

OnPlayerSpawned( player_entity )

OnWorldInitialized[]

OnWorldInitialized()

Run whenever the game creates/loads a new world. Despite the name, OnWorldPreUpdate and OnWorldPostUpdate will still be called at least once before OnWorldInitialized is called.

OnWorldPostUpdate[]

OnWorldPreUpdate[]

General functions[]

EntityLoad[]

EntityLoad( filename, OPTIONAL pos_x, OPTIONAL pos_y ) -> entity_id


EntityLoadCameraBound[]

EntityLoadCameraBound( filename, OPTIONAL pos_x, OPTIONAL pos_y )


EntityLoadToEntity[]

EntityLoadToEntity( filename, entity )

Loads components from 'filename' to 'entity'. Does not load tags and other stuff.


EntitySave[]

EntitySave( entity_id, filename )

  • Note: works only in dev builds


EntityCreateNew[]

EntityCreateNew( OPTIONAL name ) -> entity_id


EntityKill[]

EntityKill( entity_id )


EntityGetIsAlive[]

EntityGetIsAlive( entity_id ) -> bool


EntityAddComponent[]

EntityAddComponent( entity_id, component_type_name, OPTIONAL table_of_component_values ) -> component_id


EntityRemoveComponent[]

EntityRemoveComponent( entity_id, component_id )


EntityGetAllComponents[]

EntityGetAllComponents( entity_id ) -> {component_id}


EntityGetComponent[]

EntityGetComponent( entity_id, component_type_name, OPTIONAL tag ) -> {component_id}|nil

  • Note: Despite its name, this function actually returns an array, and not a single component.

EntityGetFirstComponent[]

EntityGetFirstComponent( entity_id, component_type_name, OPTIONAL tag ) -> component_id|nil

  • Does not return components that are disabled, effectively "hiding" components that you might actually want.

EntityGetComponentIncludingDisabled[]

EntityGetComponentIncludingDisabled( entity_id, component_type_name, OPTIONAL tag ) -> {component_id}|nil

  • Note: Despite its name, this function actually returns an array, and not a single component.

EntityGetFirstComponentIncludingDisabled[]

EntityGetFirstComponentIncludingDisabled( entity_id, component_type_name, OPTIONAL tag ) -> component_id|nil


EntitySetTransform[]

EntitySetTransform( entity_id, x, OPTIONAL y, OPTIONAL rotation, OPTIONAL scale_x, OPTIONAL scale_y )


EntityApplyTransform[]

EntityApplyTransform( entity_id, x, OPTIONAL y, OPTIONAL rotation, OPTIONAL scale_x, OPTIONAL scale_y )

Some components store old positions (and calculates the new one based on those). This tries to refresh those.


EntityGetTransform[]

EntityGetTransform( entity_id ) -> x,y,rotation,scale_x,scale_y


EntityAddChild[]

EntityAddChild( parent_id, child_id )


EntityGetAllChildren[]

EntityGetAllChildren( entity_id ) -> {entity_id}|nil


EntityGetParent[]

EntityGetParent( entity_id ) -> entity_id


EntityGetRootEntity[]

EntityGetRootEntity( entity_id ) -> entity_id

returns the given entity if it has no parent, otherwise walks up the parent hierarchy to the highest parent and returns it


EntityRemoveFromParent[]

EntityRemoveFromParent( entity_id )


EntitySetComponentsWithTagEnabled[]

EntitySetComponentsWithTagEnabled( entity_id, tag, enabled )


EntitySetComponentIsEnabled[]

EntitySetComponentIsEnabled( entity_id, component_id, is_enabled )


EntityGetName[]

EntityGetName( entity_id ) -> string


EntitySetName[]

EntitySetName( entity_id, name )


EntityGetTags[]

EntityGetTags( entity_id ) -> string|nil

string is comma separated


EntityGetWithTag[]

EntityGetWithTag( entity_tag ) -> {entity_id}


EntityGetInRadius[]

EntityGetInRadius( pos_x, pos_y, radius ) -> {entity_id}


EntityGetInRadiusWithTag[]

EntityGetInRadiusWithTag( pos_x, pos_y, radius, entity_tag ) -> {entity_id}


EntityGetClosest[]

EntityGetClosest( pos_x, pos_y ) -> entity_id


EntityGetClosestWithTag[]

EntityGetClosestWithTag( pos_x, pos_y, string tag ) -> entity_id


EntityGetWithName[]

EntityGetWithName( name ) -> entity_id


EntityAddTag[]

EntityAddTag( entity_id, tag )


EntityRemoveTag[]

EntityRemoveTag( entity_id, tag )


EntityHasTag[]

EntityHasTag( entity_id, tag ) -> bool


ComponentAddTag[]

ComponentAddTag( component_id, tag )


ComponentRemoveTag[]

ComponentRemoveTag( component_id, tag )


ComponentHasTag[]

ComponentHasTag( component_id, tag ) -> bool


ComponentGetValue2[]

ComponentGetValue2( component_id, field_name ) -> multiple types|nil

Returns one or many values matching the type or subtypes of the requested field. Reports error and returns nil if the field type is not supported or field was not found.


ComponentSetValue2[]

ComponentSetValue2( component_id, field_name, value(s) )

Sets the value of a field. Value(s) should have a type matching the field type. Reports error if the values weren't given in correct type, the field type is not supported, or the component does not exist.


ComponentObjectGetValue2[]

ComponentObjectGetValue2( component_id, object_name, field_name ) -> multiple types|nil

Returns one or many values matching the type or subtypes of the requested field in a component subobject. Reports error and returns nil if the field type is not supported or 'object_name' is not a metaobject.


ComponentObjectSetValue2[]

ComponentObjectSetValue2( component_id, object_name, field_name, value(s) )

Sets the value of a field in a component subobject. Value(s) should have a type matching the field type. Reports error if the values weren't given in correct type, the field type is not supported or 'object_name' is not a metaobject.


EntityAddComponent2[]

EntityAddComponent2( entity_id, component_type_name, OPTIONAL table_of_component_values ) -> component_id

Creates a component of type 'component_type_name' and adds it to 'entity_id'. 'table_of_component_values' should be a string-indexed table, where keys are field names and values are field values of correct type. The value setting works like ComponentObjectSetValue2(), with the exception that multivalue types are not supported. Additional supported values are _tags:comma_separated_string and _enabled:bool, which basically work like the same values work in entity XML files. Returns the created component, if creation succeeded, or nil.


ComponentGetVectorSize[]

ComponentGetVectorSize( component_id, array_member_name, type_of_vector ) -> int


ComponentGetVectorValue[]

ComponentGetVectorValue( component_id, array_name, type, i ) -> multiple return types|nil


ComponentGetVector[]

ComponentGetVector( component_id, array_name, type ) -> {multiple types}|nil


ComponentGetIsEnabled[]

ComponentGetIsEnabled( component_id ) -> bool

Returns true if the given component exists and is enabled, else false.


ComponentGetMembers[]

ComponentGetMembers( component_id ) -> {string-string}

returns a string-indexed table of string


ComponentObjectGetMembers[]

ComponentObjectGetMembers( component_id, object_name ) -> {string-string}|nil

returns a string-indexed table of string


ComponentGetTypeName[]

ComponentGetTypeName( component_id ) -> string


GetUpdatedEntityID[]

GetUpdatedEntityID() -> entity_id


GetUpdatedComponentID[]

GetUpdatedComponentID() -> component_id


SetTimeOut[]

SetTimeOut( time_to_execute:number, file_to_execute:string, function_to_call:string = nil )


RegisterSpawnFunction[]

RegisterSpawnFunction( uint32 color, string function_name )


SpawnActionItem[]

SpawnActionItem( x, y, level )


SpawnStash[]

SpawnStash( x, y, level, action_count ) -> entity_id


SpawnApparition[]

SpawnApparition( x, y, level ) -> int,entity_id


LoadEntityToStash[]

LoadEntityToStash( entity_file, stash_id )


AddMaterialInventoryMaterial[]

AddMaterialInventoryMaterial( entity_id, material_name, count )


GameScreenshake[]

GameScreenshake( strength, OPTIONAL pos_x, OPTIONAL pos_y )


GameOnCompleted[]

GameOnCompleted()


GameDoEnding2[]

GameDoEnding2()


BiomeMapLoad_KeepPlayer[]

BiomeMapLoad_KeepPlayer( filename, pixel_scenes = 'data/biome/_pixel_scenes.xml' )


BiomeMapLoad[]

BiomeMapLoad( filename )


GameIsIntroPlaying[]

GameIsIntroPlaying() -> bool


GameGetIsGamepadConnected[]

GameGetIsGamepadConnected() -> bool


GameGetWorldStateEntity[]

GameGetWorldStateEntity() -> entity_id


GameGetPlayerStatsEntity[]

GameGetPlayerStatsEntity() -> entity_id


GameGetOrbCountAllTime[]

GameGetOrbCountAllTime() -> int


GameGetOrbCountThisRun[]

GameGetOrbCountThisRun() -> int


GameGetOrbCollectedThisRun[]

GameGetOrbCollectedThisRun( int orb_id_zero_based ) -> bool


GameGetOrbCollectedAllTime[]

GameGetOrbCollectedAllTime( int orb_id_zero_based ) -> bool


GameClearOrbsFoundThisRun[]

GameClearOrbsFoundThisRun()


CellFactory_GetName[]

CellFactory_GetName( int material_id ) -> string


CellFactory_GetType[]

CellFactory_GetType( string material_name ) -> int


CellFactory_GetAllLiquids[]

CellFactory_GetAllLiquids( include_statics = true ) -> {string}


CellFactory_GetAllSands[]

CellFactory_GetAllSands( include_statics = true ) -> {string}


CellFactory_GetAllGases[]

CellFactory_GetAllGases( include_statics = true ) -> {string}


CellFactory_GetAllFires[]

CellFactory_GetAllFires( include_statics = true ) -> {string}


CellFactory_GetAllSolids[]

CellFactory_GetAllSolids( include_statics = true ) -> {string}


GameGetCameraPos[]

GameGetCameraPos() -> x,y


GameSetCameraPos[]

GameSetCameraPos( x, y )


GameSetCameraFree[]

GameSetCameraFree( is_free )


GameRegenItemAction[]

GameRegenItemAction( entity_id )


GameRegenItemActionsInContainer[]

GameRegenItemActionsInContainer( entity_id )


GameRegenItemActionsInPlayer[]

GameRegenItemActionsInPlayer( entity_id )


GameKillInventoryItem[]

GameKillInventoryItem( inventory_owner_entity_id, item_entity_id )


GamePickUpInventoryItem[]

GamePickUpInventoryItem( who_picks_up_entity_id, item_entity_id, do_pick_up_effects = true )


GameDropAllItems[]

GameDropAllItems( entity_id )


GameDropPlayerInventoryItems[]

GameDropPlayerInventoryItems( entity_id )


GameDestroyInventoryItems[]

GameDestroyInventoryItems( entity_id )


GameIsInventoryOpen[]

GameIsInventoryOpen() -> bool


GameTriggerGameOver[]

GameTriggerGameOver()


LoadPixelScene[]

LoadPixelScene( string materials_filename, string colors_filename, x, y, string background_file, skip_biome_checks = false, skip_edge_textures = false, color_to_material_table = {}, int background_z_index = 50 )


LoadBackgroundSprite[]

LoadBackgroundSprite( string background_file, x, y, float background_z_index = 40.0, bool check_biome_corners = false )


GameCreateParticle[]

GameCreateParticle( string material_name, x, y, how_many, xvel, yvel, just_visual, OPTIONAL draw_as_long )


GameCreateSpriteForXFrames[]

GameCreateSpriteForXFrames( string filename, world_x, world_y, bool centered = true, sprite_offset_x = 0, sprite_offset_y = 0, frames = 1, draw_over_fog_of_war = false)


GameShootProjectile[]

GameShootProjectile( who_shot, x, y, target_x, target_y, projectile_entity, send_message = true )


EntityInflictDamage[]

EntityInflictDamage( entity:int, amount:number, damage_type:string, description:string, ragdoll_fx:string, impulse_x:number, impulse_y:number, entity_who_is_responsible:int = 0, world_pos_x:number = entity_x, world_pos_y:number = entity_y, knockback_force:number = 0 )


EntityIngestMaterial[]

EntityIngestMaterial( entity:int, material_type:number, amount:number )

Has the same effects that would occur if 'entity' eats 'amount' number of cells of 'material_type' from the game world. Use this instead of directly modifying IngestionComponent values, if possible. Might not work with non-player entities. Use CellFactory_GetType() to convert a material name to material type.


EntityAddRandomStains[]

EntityAddRandomStains( entity:int, material_type:number, amount:number )

Adds random visible stains of 'material_type' to entity. 'amount' controls the number of stain cells added. Does nothing if 'entity' doesn't have a SpriteStainsComponent. Use CellFactory_GetType() to convert a material name to material type.


EntitySetDamageFromMaterial[]

EntitySetDamageFromMaterial( entity:int, material_name:string, damage:number )

Modifies DamageModelComponents materials_that_damage and materials_how_much_damage variables (and their parsed out data structures)


EntityRefreshSprite[]

EntityRefreshSprite( entity:int, sprite_component:int )

Immediately refreshes the given SpriteComponent. Might be useful with text sprites if you want them to update more often than once a second.


GamePlayAnimation[]

GamePlayAnimation( entity_id, name, priority, OPTIONAL followup_name, OPTIONAL followup_priority )


GameGetVelocityCompVelocity[]

GameGetVelocityCompVelocity( entity_id ) -> x,y


GameGetGameEffect[]

GameGetGameEffect( entity_id, string GAME_EFFECT ) -> component_id


GameGetGameEffectCount[]

GameGetGameEffectCount( entity_id, string GAME_EFFECT ) -> uint


LoadGameEffectEntityTo[]

LoadGameEffectEntityTo( entity_id, string game_effect_entity_file ) -> effect_entity_id


GetGameEffectLoadTo[]

GetGameEffectLoadTo( entity_id, string game_effect_name, always_load_new ) -> effect_component_id,effect_entity_id


SetPlayerSpawnLocation[]

SetPlayerSpawnLocation( x, y )


UnlockItem[]

UnlockItem( action_id )


GameGetPotionColorUint[]

GameGetPotionColorUint( entity_id ) -> uint


EntityGetFirstHitboxCenter[]

EntityGetFirstHitboxCenter( entity_id ) -> x:number,y:number|nil

Returns the centroid of first enabled HitboxComponent found in entity, the position of the entity if no hitbox is found, or nil if the entity does not exist. All returned positions are in world coordinates.


Raytrace[]

Raytrace( x1, y1, x2, y2 ) -> did_hit,hit_x,hit_y

Does a raytrace that stops on any cell it hits.


RaytraceSurfaces[]

RaytraceSurfaces( x1, y1, x2, y2 ) -> did_hit,hit_x,hit_y

Does a raytrace that stops on any cell that is not fluid, gas (yes, technically gas is a fluid), or fire.


RaytraceSurfacesAndLiquiform[]

RaytraceSurfacesAndLiquiform( x1, y1, x2, y2 ) -> did_hit,hit_x,hit_y

Does a raytrace that stops on any cell that is not gas or fire.


RaytracePlatforms[]

RaytracePlatforms( x1, y1, x2, y2 ) -> did_hit,hit_x,hit_y

Does a raytrace that stops on any cell a character can stand on.


FindFreePositionForBody[]

FindFreePositionForBody( ideal_pos_x, idea_pos_y, velocity_x, velocity_y, body_radius ) -> x,y


GetSurfaceNormal[]

GetSurfaceNormal( pos_x, pos_y, ray_length, ray_count ) -> found_normal,normal_x,normal_y,approximate_distance_from_surface


DoesWorldExistAt[]

DoesWorldExistAt( min_x, min_y, max_x, max_y ) -> bool

Returns true if the area inside the bounding box defined by the parameters has been streamed in and no pixel scenes are loading in the area.


StringToHerdId[]

StringToHerdId( herd_name:string ) -> int


HerdIdToString[]

HerdIdToString( herd_id:int ) -> string


GetHerdRelation[]

GetHerdRelation( herd_id_a:int, herd_id_b:int ) -> number


EntityGetHerdRelation[]

EntityGetHerdRelation( entity_a:int, entity_b:int ) -> number


GenomeSetHerdId[]

GenomeSetHerdId( entity_id:int, new_herd_id:string )

Deprecated, use GenomeStringToHerdID() and ComponentSetValue2() instead.


GamePrint[]

GamePrint( string log_line )


GamePrintImportant[]

GamePrintImportant( string title, description )


DEBUG_GetMouseWorld[]

DEBUG_GetMouseWorld() -> x,y


DEBUG_MARK[]

DEBUG_MARK( x, y, string message="", color_r=1, color_g=0, color_b=0 )


GameGetFrameNum[]

GameGetFrameNum() -> int


GameGetRealWorldTimeSinceStarted[]

GameGetRealWorldTimeSinceStarted() -> number


IsPlayer[]

IsPlayer( entity ) -> bool


GameIsDailyRun[]

GameIsDailyRun() -> bool


GameIsDailyRunOrDailyPracticeRun[]

GameIsDailyRunOrDailyPracticeRun() -> bool


GameIsModeFullyDeterministic[]

GameIsModeFullyDeterministic() -> bool


GlobalsSetValue[]

GlobalsSetValue( key, value )


GlobalsGetValue[]

GlobalsGetValue( key, default_value = "" )


MagicNumbersGetValue[]

MagicNumbersGetValue( key ) -> string


SetWorldSeed[]

SetWorldSeed( new_seed )


SessionNumbersGetValue[]

SessionNumbersGetValue( key ) -> string


SessionNumbersSetValue[]

SessionNumbersSetValue( key, value )


SessionNumbersSave[]

SessionNumbersSave()


AutosaveDisable[]

AutosaveDisable()


StatsGetValue[]

StatsGetValue( key ) -> string


StatsGlobalGetValue[]

StatsGlobalGetValue( key ) -> string


StatsBiomeGetValue[]

StatsBiomeGetValue( key ) -> string


StatsBiomeReset[]

StatsBiomeReset()


StatsLogPlayerKill[]

StatsLogPlayerKill()


CreateItemActionEntity[]

CreateItemActionEntity( action_id, OPTIONAL x, OPTIONAL y ) -> entity_id


GetRandomActionWithType[]

GetRandomActionWithType( x, y, max_level, type, i = 0) -> string


GetRandomAction[]

GetRandomAction( x, y, max_level, i = 0) -> string


GameGetDateAndTimeUTC[]

GameGetDateAndTimeUTC() -> year_int,month_int,day_int,hour_int,minute_int,second_int


GameGetDateAndTimeLocal[]

GameGetDateAndTimeLocal() -> year_int,month_int,day_int,hour_int,minute_int,second_int


GameEmitRainParticles[]

GameEmitRainParticles( num_particles, width_outside_camera, material_name, velocity_min, velocity_max, gravity, droplets_bounce, draw_as_long )


BiomeMapGetVerticalPositionInsideBiome[]

BiomeMapGetVerticalPositionInsideBiome( x, y ) -> number


BiomeMapGetName[]

BiomeMapGetName( OPTIONAL x, OPTIONAL y ) -> name


SetRandomSeed[]

SetRandomSeed(x,y)

Sets the current seed of the random number generator, so that for the same input you get the same sequence every time.


Random[]

Random( OPTIONAL a, OPTIONAL b ) -> number|int.

This is kinda messy. If given 0 arguments, returns number between 0.0 and 1.0. If given 1 arguments, returns int between 0 and 'a'. If given 2 arguments returns int between 'a' and 'b'.


Randomf[]

Randomf( min, max ) -> number

This is kinda messy. If given 0 arguments, returns number between 0.0 and 1.0. If given 1 arguments, returns number between 0.0 and 'a'. If given 2 arguments returns number between 'a' and 'b'.


RandomDistribution[]

RandomDistribution( min, max, mean, (sharpness=1.f), (baseline=0.005) ) -> int


RandomDistributionf[]

RandomDistributionf( min, max, mean, (sharpness=1.f), (baseline=0.005) ) -> number


ProceduralRandom[]

ProceduralRandom( x, y, OPTIONAL a, OPTIONAL b ) -> int|number

This is kinda messy. If given 2 arguments, returns number between 0.0 and 1.0. If given 3 arguments, returns int between 0 and 'a'. If given 4 arguments returns number between 'a' and 'b'.


ProceduralRandomf[]

ProceduralRandomf( x, y, OPTIONAL a, OPTIONAL b ) -> number

This is kinda messy. If given 2 arguments, returns number between 0.0 and 1.0. If given 3 arguments, returns a number between 0 and 'a'. If given 4 arguments returns a number between 'a' and 'b'.


ProceduralRandomi[]

ProceduralRandomi( x, y, OPTIONAL a, OPTIONAL b ) -> number

This is kinda messy. If given 2 arguments, returns 0 or 1. If given 3 arguments, returns an int between 0 and 'a'. If given 4 arguments returns an int between 'a' and 'b'.


PhysicsAddBodyImage[]

PhysicsAddBodyImage( entity_id, image_file, material = "", offset_x = 0, offset_y = 0, bool centered = false, bool is_circle = false, material_image_file = "", bool use_image_as_colors = true ) -> int_body_id

Does not work with PhysicsBody2Component.


PhysicsAddBodyCreateBox[]

PhysicsAddBodyCreateBox( entity_id, material, offset_x, offset_y, width, height, bool centered = false ) -> int_body_id|nil

Does not work with PhysicsBody2Component.


PhysicsAddJoint[]

PhysicsAddJoint( entity_id, body_id0, body_id1, offset_x, offset_y, string joint_type ) -> int_joint_id

Does not work with PhysicsBody2Component.


PhysicsApplyForce[]

PhysicsApplyForce( entity_id, float force_x, float force_y )


PhysicsApplyTorque[]

PhysicsApplyTorque( entity_id, float torque )


PhysicsApplyTorqueToComponent[]

PhysicsApplyTorqueToComponent( entity_id, component_id, float torque )


PhysicsApplyForceOnArea[]

PhysicsApplyForceOnArea( calculate_force_for_body_fn:function, ignore_this_entity:int, area_min_x:number, area_min_y:number,area_max_x:number, area_max_y:number )

Applies a force calculated by 'calculate_force_for_body_fn' to all bodies in an area. 'calculate_force_for_body_fn' should be a lua function with the following signature: function( body_entity:int, body_mass:number, body_x:number, body_y:number, body_vel_x:number, body_vel_y:number, body_vel_angular:number ) -> force_world_pos_x:number,force_world_pos_y:number,force_x:number,force_y:number,force_angular:number


PhysicsRemoveJoints[]

PhysicsRemoveJoints( world_pos_min_x, world_pos_min_y, world_pos_max_x, world_pos_max_y )


PhysicsSetStatic[]

PhysicsSetStatic( entity_id, bool is_static )


PhysicsGetComponentVelocity[]

PhysicsGetComponentVelocity( entity_id, component_id ) -> vel_x,vel_y


PhysicsGetComponentAngularVelocity[]

PhysicsGetComponentAngularVelocity( entity_id, component_id ) -> vel


PhysicsBody2InitFromComponents[]

PhysicsBody2InitFromComponents( entity_id )


PhysicsVecToGameVec[]

PhysicsVecToGameVec( x, OPTIONAL y ) -> x,y


GameVecToPhysicsVec[]

GameVecToPhysicsVec( x, OPTIONAL y ) -> x,y


LooseChunk[]

LooseChunk( world_pos_x, world_pos_y, image_filename, OPTIONAL max_durability )


AddFlagPersistent[]

AddFlagPersistent( key ) -> bool_is_new


RemoveFlagPersistent[]

RemoveFlagPersistent( key )


HasFlagPersistent[]

HasFlagPersistent( key ) -> bool


GameAddFlagRun[]

GameAddFlagRun( flag )


GameRemoveFlagRun[]

GameRemoveFlagRun( flag )


GameHasFlagRun[]

GameHasFlagRun( flag ) -> bool


GameTriggerMusicEvent[]

GameTriggerMusicEvent( event_path, can_be_faded, x, y )


GameTriggerMusicCue[]

GameTriggerMusicCue( name )


GameTriggerMusicFadeOutAndDequeueAll[]

GameTriggerMusicFadeOutAndDequeueAll( OPTIONAL relative_fade_speed )


GamePlaySound[]

GamePlaySound( bank_filename, event_path, x, y )


GameEntityPlaySound[]

GameEntityPlaySound( entity, event_name )


GameEntityPlaySoundLoop[]

GameEntityPlaySoundLoop( entity:int, component_tag:string, intensity:number )

Plays a sound loop through an AudioLoopComponent tagged with 'component_tag' in 'entity'. 'intensity' affects the intensity passed to the audio event. Must be called every frame when the sound should play.


GameSetPostFxParameter[]

GameSetPostFxParameter( name:string, x:number, y:number, z:number, w:number )

Can be used to pass custom parameters to the post_final shader, or override values set by the game code. The shader uniform called 'name' will be set to the latest given values on this and following frames.


GameUnsetPostFxParameter[]

GameUnsetPostFxParameter( name:string )

Will remove a post_final shader parameter value binding set via game GameSetPostFxParameter().


GameTextGetTranslatedOrNot[]

GameTextGetTranslatedOrNot( text_or_key ) -> string


GameTextGet[]

GameTextGet( key, OPTIONAL param0, OPTIONAL param1, OPTIONAL param2 ) -> string


GuiCreate[]

GuiCreate() -> gui


GuiDestroy[]

GuiDestroy( gui )


GuiStartFrame[]

GuiStartFrame( gui )


GuiText[]

GuiText( gui, x, y, text )


GuiTextCentered[]

GuiTextCentered( gui, x, y, text )


GuiButton[]

GuiButton( gui, x, y, text, id ) -> bool_clicked


GuiLayoutBeginHorizontal[]

GuiLayoutBeginHorizontal( gui, x_rel, y_rel )


GuiLayoutBeginVertical[]

GuiLayoutBeginVertical( gui, x_rel, y_rel )


GuiLayoutAddHorizontalSpacing[]

GuiLayoutAddHorizontalSpacing( gui )


GuiLayoutAddVerticalSpacing[]

GuiLayoutAddVerticalSpacing( gui )


GuiLayoutEnd[]

GuiLayoutEnd( gui )


DebugGetIsDevBuild[]

DebugGetIsDevBuild() -> bool


DebugEnableTrailerMode[]

DebugEnableTrailerMode()


GameGetIsTrailerModeEnabled[]

GameGetIsTrailerModeEnabled() -> bool


Debug_SaveTestPlayer[]

Debug_SaveTestPlayer()

This doesn't do anything at the moment.


DebugBiomeMapGetFilename[]

DebugBiomeMapGetFilename( OPTIONAL x, OPTIONAL y ) -> name


EntityConvertToMaterial[]

EntityConvertToMaterial( entity_id, string material )


ConvertEverythingToGold[]

ConvertEverythingToGold( material_static )

GetDailyPracticeRunSeed[]

GetDailyPracticeRunSeed()


ModIsEnabled[]

ModIsEnabled( mod_id ) -> bool

Returns true if a mod with the id 'mod_id' is currently active. For example mod_id = "nightmare".


ModGetActiveModIDs[]

ModGetActiveModIDs() -> {string}

Returns a table filled with the IDs of currently active mods.


ModGetAPIVersion[]

ModGetAPIVersion() -> uint


StreamingGetIsConnected[]

StreamingGetIsConnected() -> bool


StreamingGetVotingCycleDurationFrames[]

StreamingGetVotingCycleDurationFrames() -> int


StreamingGetRandomViewerName[]

StreamingGetRandomViewerName() -> string


StreamingGetSettingsGhostsNamedAfterViewers[]

StreamingGetSettingsGhostsNamedAfterViewers() -> bool


SetValueNumber[]

SetValueNumber( key, value )


GetValueNumber[]

GetValueNumber( key, default_value )


SetValueInteger[]

SetValueInteger( key, value )


GetValueInteger[]

GetValueInteger( key, default_value )


SetValueBool[]

SetValueBool( key, value )


GetValueBool[]

GetValueBool( key, default_value )


dofile[]

dofile( filename ) -> nil|script_return_type|nil,error_string

Returns the script's return value, if any. Returns nil,error_string if the script had errors.


dofile_once[]

dofile_once( filename ) -> nil|script_return_type|nil,error_string

Runs the script only once per lua context, returns the script's return value, if any. Returns nil,error_string if the script had errors. For performance reasons it is recommended scripts use dofile_once(), unless the standard dofile behaviour is required.


EntityGetFilename[]

EntityGetFilename( int:entity_id ) -> string

Returns the name of the file (game directory included) which was originally used to create the entity.


Available only inside a custom BIOME_MAP[]

BiomeMapSetSize[]

BiomeMapSetSize( w, h )

This is available if BIOME_MAP in magic_numbers.xml points to a lua file, in the context of that file.


BiomeMapGetSize[]

BiomeMapGetSize() -> w,h

This is available if BIOME_MAP in magic_numbers.xml points to a lua file, in the context of that file.


BiomeMapSetPixel[]

BiomeMapSetPixel( x, y, color_int )

This is available if BIOME_MAP in magic_numbers.xml points to a lua file, in the context of that file.


BiomeMapGetPixel[]

BiomeMapGetPixel( x, y ) -> color_int

This is available if BIOME_MAP in magic_numbers.xml points to a lua file, in the context of that file.


BiomeMapConvertPixelFromUintToInt[]

BiomeMapConvertPixelFromUintToInt( uint32 ) -> int32

To make sense of the BiomeMapGetPixel() return values. E.g. if( BiomeMapGetPixel( x, y ) == BiomeMapConvertPixelFromUintToInt( 0xFF36D517 ) ) then print('hills') end


BiomeMapLoadImage[]

BiomeMapLoadImage( x, y, path )

This is available if BIOME_MAP in magic_numbers.xml points to a lua file, in the context of that file.


BiomeMapLoadImageCropped[]

BiomeMapLoadImageCropped( x, y, path, image_x, image_y, image_w, image_h )

This is available if BIOME_MAP in magic_numbers.xml points to a lua file, in the context of that file.


Available only during mod initialization[]

ModLuaFileAppend[]

ModLuaFileAppend( to_filename, from_filename )

Basically calls dofile(from_filename) at the end of 'to_filename'. Available only during mod initialization.


ModTextFileGetContent[]

ModTextFileGetContent( filename ) -> string

Returns the current (modded or not) content of the data file 'filename'. Allows access only to data files and files from enabled mods. Available only during mod initialization.


ModTextFileSetContent[]

ModTextFileSetContent( filename, new_content )

Sets the content the game sees for the file 'filename'. Allows access only to mod and data files. Available only during mod initialization.


ModTextFileWhoSetContent[]

ModTextFileWhoSetContent( filename ) -> string

Returns the id of the last mod that called ModTextFileSetContent with 'filename', or "". Available only during mod initialization.


ModMagicNumbersFileAdd[]

ModMagicNumbersFileAdd( filename )

Available only during mod initialization.


ModMaterialsFileAdd[]

ModMaterialsFileAdd( filename )

Available only during mod initialization.


ModRegisterAudioEventMappings[]

ModRegisterAudioEventMappings( filename )

Available only during mod initialization.


ModDevGenerateSpriteUVsForDirectory[]

ModDevGenerateSpriteUVsForDirectory( directory_path )

Available only during mod initialization via noita_dev.exe


BiomeSetValue[]

BiomeSetValue( filename, field_name, value )

Can be used to edit biome configs during initialization. See the nightmare mod for an usage example.


BiomeGetValue[]

BiomeGetValue( filename, field_name ) -> multiple types|nil

Can be used to read biome configs. Returns one or many values matching the type or subtypes of the requested field. Reports error and returns nil if the field type is not supported or field was not found.


BiomeObjectSetValue[]

BiomeObjectSetValue( filename, meta_object_name, field_name, value )

Can be used to edit biome configs during initialization. See biome_modifiers.lua for an usage example.


BiomeVegetationSetValue[]

BiomeVegetationSetValue( filename, material_name, field_name, value )

Can be used to edit biome config MaterialComponents during initialization. Sets the given value in all found VegetationComponent with matching tree_material. See biome_modifiers.lua for an usage example.


BiomeMaterialSetValue[]

BiomeMaterialSetValue( filename, material_name, field_name, value )

Can be used to edit biome config MaterialComponents during initialization. Sets the given value in the first found MaterialComponent with matching material_name. See biome_modifiers.lua for an usage example.


BiomeMaterialGetValue[]

BiomeMaterialGetValue( filename, material_name, field_name )

Can be used to read biome config MaterialComponents during initialization. Returns the given value in the first found MaterialComponent with matching material_name. See biome_modifiers.lua for an usage example.


Available only in data/scripts/gun/gun.lua[]

RegisterProjectile[]

RegisterProjectile( entity_filename )


RegisterGunAction[]

RegisterGunAction()


RegisterGunShotEffects[]

RegisterGunShotEffects()


BeginProjectile[]

BeginProjectile( entity_filename )


EndProjectile[]

EndProjectile()


BeginTriggerTimer[]

BeginTriggerTimer( timeout_frames )


BeginTriggerHitWorld[]

BeginTriggerHitWorld()


BeginTriggerDeath[]

BeginTriggerDeath()


EndTrigger[]

EndTrigger()


SetProjectileConfigs[]

SetProjectileConfigs()


StartReload[]

StartReload( reload_time )


ActionUsesRemainingChanged[]

ActionUsesRemainingChanged( inventoryitem_id, uses_remaining )


ActionUsed[]

ActionUsed( inventoryitem_id )


LogAction[]

LogAction( action_name )


OnActionPlayed[]

OnActionPlayed( action_id )


OnNotEnoughManaForAction[]

OnNotEnoughManaForAction()


BaabInstruction[]

BaabInstruction( name )


Deprecated[]

ComponentGetValue[]

ComponentGetValue( component_id, variable_name ) -> string|nil

Deprecated, use ComponentGetValue2() instead.


ComponentGetValueBool[]

ComponentGetValueBool( component_id, variable_name ) -> bool

Deprecated, use ComponentGetValue2() instead.


ComponentGetValueInt[]

ComponentGetValueInt( component_id, variable_name ) -> int

Deprecated, use ComponentGetValue2() instead.


ComponentGetValueFloat[]

ComponentGetValueFloat( component_id, variable_name ) -> number

Deprecated, use ComponentGetValue2() instead.


ComponentGetValueVector2[]

ComponentGetValueVector2( component_id, variable_name ) -> x,y

Deprecated, use ComponentGetValue2() instead.


ComponentSetValue[]

ComponentSetValue( component_id, variable_name, value )

Deprecated, use ComponentSetValue2() instead.


ComponentSetValueVector2[]

ComponentSetValueVector2( component_id, variable_name, x, y )

Deprecated, use ComponentSetValue2() instead.


ComponentSetValueValueRange[]

ComponentSetValueValueRange( component_id, variable_name, min, max )

Deprecated, use ComponentSetValue2() instead.


ComponentSetValueValueRangeInt[]

ComponentSetValueValueRangeInt( component_id, variable_name, min, max )

Deprecated, use ComponentSetValue2() instead.


ComponentSetMetaCustom[]

ComponentSetMetaCustom( component_id, variable_name, value )

Deprecated, use ComponentSetValue2() instead.


ComponentGetMetaCustom[]

ComponentGetMetaCustom( component_id, variable_name ) -> string|nil

Deprecated, use ComponentGetValue2() instead.


ComponentObjectGetValue[]

ComponentObjectGetValue( component_id, object_name, variable_name ) -> string|nil

Deprecated, use ComponentObjectGetValue2() instead.


ComponentObjectGetValueBool[]

ComponentObjectGetValueBool( component_id, object_name, variable_name ) -> string|nil

Deprecated, use ComponentObjectGetValue2() instead.


ComponentObjectGetValueInt[]

ComponentObjectGetValueInt( component_id, object_name, variable_name ) -> string|nil

Deprecated, use ComponentObjectGetValue2() instead.


ComponentObjectGetValueFloat[]

ComponentObjectGetValueFloat( component_id, object_name, variable_name ) -> string|nil

Deprecated, use ComponentObjectGetValue2() instead.


ComponentObjectSetValue[]

ComponentObjectSetValue( component_id, object_name, variable_name, value )

Deprecated, use ComponentObjectSetValue2() instead.

Advertisement