Roblox 使用可以作为参数传递的函数,类似于回调函数。
Empty
Empty
Empty
local function completeTask(callback)
print("Performing task")
wait(2) -- Simulating task duration
callback("Task completed successfully")
end
local function taskCallback(result)
print("Callback received:", result)
end
completeTask(taskCallback)
Roblox Studio