{
"$type": "site.standard.document",
"bskyPostRef": {
"cid": "bafyreiagqnp3g2yrqeyva4fzzb6hpaancfn7uny4mwybfa3wv2a5okjsu4",
"uri": "at://did:plc:i7budt2wflrcfy6jtvfocbix/app.bsky.feed.post/3mfwxansvyil2"
},
"path": "/viewtopic.php?p=1278315#p1278315",
"publishedAt": "2026-02-28T14:02:26.000Z",
"site": "https://www.tt-forums.net",
"tags": [
"GoldMine"
],
"textContent": "For those who don't know what nasal demons are it's when you get frustrated with strange program flow so much you start to blame compiler, and out of frustration demons start to go out of your nose. (you can google for details if you want)\n\nI got frustrated because noticed squirrel doesn't let you copy AIList or tables.\nActually you can copy them and your copy will be fine as long as original isn't modified, but as soon as you clear the source table or list your copy will no longer be a copy, data will be lost in both containers because for some unholy reason memory is somehow shared.\n\nEven if you manually copy AIList with AddItem it's still not going to be an independent copy, this is the most stupid language feature I've ever seen, why the f I can't make a copy?\n\nI found the only solution to make an independent copy of a container such that modifying the source leaves the copy alone is to create an array and extend it with data you want to copy.\nFor instance:\n\n\nCode:\n\n\n local lst = [];local add = [];add.extend(lst); // I'm true independent copy\n\nThe \"add\" is now true copy, you can clear or modify \"lst\" but add will keep the copied data.\nYou can even remove elements from lst but copy keeps the data.\n\nWhy can't this be done with AIList and tables?\nWhy copying a list or table means having a copy that shares memory with source?\n\nThis is really silly.\nIt took me unreasonable time to figure out what's happening.\n\nStatistics: Posted by GoldMine — 28 Feb 2026 14:02\n\n* * *",
"title": "OpenTTD AIs and Game Scripts • nasal demons in action",
"updatedAt": "2026-02-28T14:02:26.000Z"
}