Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- main() {
- yield 1;
- wait_ms(3000);
- new List:strings1 = list_new();
- new List:strings2 = list_new();
- print("Initializing...");
- for (new i = 0; i < 5; i++) {
- new String:string1 = str_acquire(str_format("[strings1] String %i", i));
- list_add(strings1, string1);
- new String:string2 = str_acquire(str_format("[strings2] String %i", i));
- list_add_str_s(strings2, string2);
- }
- print("Initialized! Getting the first index of both lists...");
- new String:strings1At0 = String:list_get(strings1, 0);
- print_s(str_format("strings1 at index 0: %S", strings1At0));
- new String:strings2At0 = list_get_str_s(strings2, 0);
- print_s(str_format("strings2 at index 0: %S", strings2At0));
- print("Done! Deleting strings...");
- str_delete(strings1At0);
- str_delete(strings2At0);
- print("Ok! Running asynchronous...");
- yield 1;
- wait_ms(1000);
- print("Checking strings status...");
- strings1At0 = String:list_get(strings1, 0);
- print_s(str_format("strings1 at index 0 is %s", str_valid(strings1At0) ? "VALID" : "INVALID"));
- strings2At0 = list_get_str_s(strings2, 0);
- print_s(str_format("strings2 at index 0 is %s", str_valid(strings2At0) ? "VALID" : "INVALID"));
- }
- /* OUTPUT
- [2024-04-26T10:51:17+0700] [Info] Initializing...
- [2024-04-26T10:51:17+0700] [Info] Initialized! Getting the first index of both lists...
- [2024-04-26T10:51:17+0700] [Info] strings1 at index 0: [strings1] String 0
- [2024-04-26T10:51:17+0700] [Info] strings2 at index 0: [strings2] String 0
- [2024-04-26T10:51:17+0700] [Info] Done! Deleting strings...
- [2024-04-26T10:51:17+0700] [Info] Ok! Running asynchronous...
- [2024-04-26T10:51:18+0700] [Info] Checking strings status...
- [2024-04-26T10:51:18+0700] [Info] strings1 at index 0 is INVALID
- [2024-04-26T10:51:18+0700] [Info] strings2 at index 0 is VALID
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement