Access Object property in a package entry function with Object ID parameter

Consider the following code:

module experiment::test {
    struct TableA has key{
        id: UID,
        list: Table<String, bool>

    fun init(otw: TEST, ctx: &mut TxContext) { 
       // Create TableA type Object

     public entry fun add_element(
        object_id: UID,
        element_to_add: String
        // Add element to the object with the ID, object_id

In the add_element function how can I access the TableA type Object and add the string element element_to_add?

1 Like

@tahlil Set the argument to TableA object, not a UID.

    public entry fun add_elements(tableA: &mut TableA, key: String, value: bool) {
        table::add(&mut tableA.list, key, value);