Skip to main content

read_entity_string_field

Function read_entity_string_field 

Source
pub fn read_entity_string_field<T>(
    caller: &mut Caller<'_, T>,
    arg: Option<Rooted<StructRef>>,
    kind: EntityKind,
    field_name: &str,
) -> Result<Option<String>>
Expand description

Reads a named String field from an entity struct arg, resolving the field’s slot index from [nomiscript::entity_layout] (the single source of struct slot order). None returns for a null ref. Errors if the kind has no layout, the named field is absent or non-String, or the slot is not an $i8_array. This is how the draft natives read e.g. an account’s id (slot 0) from a (get-account …) entity ref passed as an argument.