What do you want to achieve? i want to print the fields(Discord Webhook) that it have multi tables
What is the issue? I dont know how to make discord fields with tables
What solutions have you tried so far? I had looked every devhub about discord webhook.
In my option, i want to make Join Log but have function like Application that can skip the answer, (if it has many Question) it must to have tables right?
If player skip the answer, it will not show on Fields
If player didn’t skip answer, it will show normally
local function Embed_Fields(name:string, value:string, inline:boolean)
local Fields = {name, value, inline}
return Fields
end
local Embed_Device = nil
local Embed_RunService = nil
local Final_Embed = nil
local Final_Fields = {}
Embed_Device = Embed_Fields("Device", Device__(), true)
Embed_RunService = Embed_Fields("RunService", RunService__(), true)
Final_Embed = {Embed_Device and Embed_RunService}
for i, v in pairs(Final_Embed) do
print(i, v)
table.insert(Final_Fields, {
["name"] = tostring(v[1]),
["value"] = tostring(v[2]),
["inline"] = tostring(v[2])
})
end
local function Final()
for i, v in pairs(Final_Fields) do
print(i, v)
task.wait(#Final_Fields)
return Final_Fields[i]
end
end
print(Final())
local joindata = {
-- embeds
}
Http:PostAsync(webhook,Http:JSONEncode(joindata))
The inline value have to be a boolean not string, so you should remove the tostring() and pass v[3] directly!
and on the Final_Embed line, you use , to separate a table’s value, not and.
The reason why Final() only return 1 value is because in the loop,
You have return Final_Fields[i], which will always return the first element of Final_Fields,
( in case you don’t know, return end the loop )
I don’t know the purpose of the Final() but it’s better to just not use that function, you can just pass Final_Fields in directly without the use of Final().
You have to unpack the Final_Fields by using table.unpack,
Right now it’s being treated as fields = { {Field}, { {Field}, {Field} } }
So, When you use table.unpack(Final_Fields), it will be treated as fields = { {Field}, {Field}, {Field} }
Example fields = { {Field}, table.unpack(Final_Fields)}
I’m busy and probably won’t get back to you in a week, so here’s another question for you.
How do I get it to bypass the result if I set it not to show? (If i setting like “ShowDevice = false”)
Seem like Adonis Setting function but change from in game to on Discord Webhook
thanks in advance.