所以我使用REST沙盒API来删除" Call"从一个状态数组,该数组包含所有JSON,不知道用什么来删除它。
请注意:这是通过HTTP连接Lua脚本运行请求。
网站:getsandbox.com
以下是代码:
//Store Calls
state.calls = state.calls || []
var calls = state.calls;
/*
|
| Create Call
V
*/
Sandbox.define('/new/call/','POST', function(req, res){
var gameid = req.get("Roblox-Id");
var person = req.body.split(" ")[0];
var reason = req.body.split(" ")[1];
var comp = {
gameid: gameid,
player: person,
callreason: reason
};
calls.push(comp);
// Set the type of response, sets the content type.
res.type('text/plain');
// Set the status code of the response.
res.status(200);
// Send the response body.
res.send('Request Accepted');
});
/*
|
| Get Calls
V
*/
Sandbox.define('/get/calls/','GET', function(req, res){
// Check the request, make sure it is a compatible type
// Set the type of response, sets the content type.
res.type('application/json');
// Set the status code of the response.
res.status(200);
// Send the response body.
res.send(calls);
})
/*
|
| Delete
v
*/
Sandbox.define('/data/delete/{gameid}/','GET', function(req, res){
for(i=0;i<calls.length;i++){
calls[i].pop();
}
// Set the type of response, sets the content type.
res.type('text/plain');
// Set the status code of the response.
res.status(200);
// Send the response body.
res.send('Successful');
})
&#13;
答案 0 :(得分:2)
找到index
的{{1}}并使用以下内容:
call