-
Discord user IDNo response Describe your question in detail.How to take array of strings as a input in move function? here is the code: What error, if any, are you getting?No response What have you tried or looked at? Or how can we reproduce the error?I have tried vector<vector> but not taking plain string as input Which operating system are you using?Linux (Ubuntu, Fedora, Windows WSL, etc.) Which SDK or tool are you using? (if any)Aptos CLI Describe your environment or tooling in detailNo response |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Here's an example of a function taking in a vector (array) of strings and modifying each one to "hello".
|
Beta Was this translation helpful? Give feedback.
-
I'm not sure if you're asking about passing multiple string arguments or example modulemodule test::test {
use std::string::String;
use std::vector;
struct Note has key {
title: String,
content: String,
}
public entry fun write_note(author: &signer, title: String, content: String) {
let note = Note{ title, content };
move_to(author, note);
}
public entry fun write_note_in_array(author: &signer, note: vector<String>) {
let content = vector::pop_back(&mut note);
let title = vector::pop_back(&mut note);
let note = Note{ title, content };
move_to(author, note);
}
} 1. multiple
|
Beta Was this translation helpful? Give feedback.
I'm not sure if you're asking about passing multiple string arguments or
vector<String>
type, so here're scenarios for both cases.example module