how would I make a article creation system like in Lua learning
I think they use dataStores, never got interested in it but it should be how it works. So save the topic as a table containing a title value, and the description value but also the author value.
local articles = {
[1] = {
["Title"] = "",
["Author"] = "",
["Content"] = "",
["CreationDate"] = ""
},
[2] = {
["Title"] = "",
["Author"] = "",
["Content"] = "",
["CreationDate"] = ""
}
}
Yeah, a dictionary of articles could look like this, with each field corresponding to its relevant value for each stored article. [1] and [2] in this example would represent the article’s assigned ID, providing a way to differentiate between articles.
1 Like
How did he add images also tho?
Pretty much just keep adding properties to the array and read/write to them using a script:
local articles = {
[1] = {
["Title"] = "",
["Author"] = "",
["Content"] = "",
["CreationDate"] = "",
["Image"] = "",
["etc."] = "etc."
},
[2] = {
["Title"] = "",
["Author"] = "",
["Content"] = "",
["CreationDate"] = "",
["Image"] = "",
["etc."] = "etc."
}
}
but what about images at locations like you can do with the devforums
local articles = {
[1] = {
["Title"] = "",
["Author"] = "",
["Content"] = "",
["CreationDate"] = "",
["Images"] = {
[1] = {
["posX"] = 100,
["posY"] = 100,
["sizX"] = 100,
["sizY"] = 100,
["id"] = "imageid"
}
}
1 Like
How would I save a array to datastores