Ir para o conteúdo principal
Version: latest - a1.82.x ⚖️

Lua Profile

How to create Lua Profiles in nanos world Forge

info

Lua Profiles are still experimental and may change in future updates. They also might not work as expected with Placeholders for now.

Lua Profiles allow you to define how to format Lua code converted by nanos world Forge. You can customize how structs and objects are exported, whether as tables or constructors, and map properties to specific functions.

Creating Lua Profiles

To create a Lua Profile, you need to create a Data Asset from the available profile types:

Profile Types

Lua Struct Format Profile

ConfiguraçãoDescription
Target StructThe UE struct type to format (e.g., FVector, FRotator)
Format ModeHow to format the struct in Lua (Constructor or Table)
Constructor NameThe Lua function to call for creating the struct
Constructor ArgumentsWhich properties to use as constructor parameters
Table FieldsWhich properties to include in the Lua table format

Example Struct Profile (Vector as Constructor)

This exports vectors as:

Vector(100.0, 200.0, 50.0)

Example Struct Profile (Transform as Table)

This exports transforms as:

{
Location = Vector(100.0, 200.0, 50.0),
Rotation = Rotator(0.0, 90.0, 0.0),
Scale = Vector(1.0, 1.0, 1.0)
}

Lua Object Format Profile

ConfiguraçãoDescription
Target ClassThe Unreal Engine object class type to format
Constructor NameThe Lua function to call for creating the object
Constructor ArgumentsWhich properties to use as constructor parameters
Property to Function MapMaps properties to specific Lua functions for formatting

Example Object Profile (Prop Placeholder)

This would export a prop placeholder as:

Prop(Vector(340, 720, 0), Rotator(0, 0, 0), "my-asset-pack::Cube")

Built-in Struct Profiles

nanos world Forge comes with several built-in struct profiles that format common Unreal structs as nanos world Lua types or easy-to-use Lua tables:

ProfileDescription
LinearColorProfileFormats FLinearColor as Color(r, g, b, a)
RotatorProfileFormats FRotator as Rotator(pitch, yaw, roll)
Vector2ProfileFormats FVector2D as Vector2D(x, y)
VectorProfileFormats FVector as Vector(x, y, z)
TransformProfileFormats FTransform as table with Location, Rotation, Scale

Lua Global Profile

After creating your struct and object profiles, create a Lua Global Profile Data Asset to combine them.

By default, it will include all built-in profiles. You can add your custom profiles to the Struct Profiles and Object Profiles arrays.

Using Profiles in Tools

You can use your custom profiles in tools like the Object2Lua tool and the Placeholder Exporter.

You just need to select your Lua Global Profile in the format settings: