mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-07-03 10:32:52 +00:00
Migrate all examples to use tweaked.cc
Might as well, I've got the server capacity to spare. Hopefully.
This commit is contained in:
parent
e1cbbe3628
commit
1316d6a3c9
@ -16,7 +16,7 @@ This event is normally handled inside @{http.get} and @{http.post}, but it can s
|
|||||||
## Example
|
## Example
|
||||||
Prints an error why the website cannot be contacted:
|
Prints an error why the website cannot be contacted:
|
||||||
```lua
|
```lua
|
||||||
local myURL = "http://this.website.does.not.exist"
|
local myURL = "https://does.not.exist.tweaked.cc"
|
||||||
http.request(myURL)
|
http.request(myURL)
|
||||||
local event, url, err
|
local event, url, err
|
||||||
repeat
|
repeat
|
||||||
|
@ -11,7 +11,7 @@ The @{websocket_closed} event is fired when an open WebSocket connection is clos
|
|||||||
## Example
|
## Example
|
||||||
Prints a message when a WebSocket is closed (this may take a minute):
|
Prints a message when a WebSocket is closed (this may take a minute):
|
||||||
```lua
|
```lua
|
||||||
local myURL = "ws://echo.websocket.org"
|
local myURL = "wss://example.tweaked.cc/echo"
|
||||||
local ws = http.websocket(myURL)
|
local ws = http.websocket(myURL)
|
||||||
local event, url
|
local event, url
|
||||||
repeat
|
repeat
|
||||||
|
@ -15,7 +15,7 @@ This event is normally handled inside @{http.websocket}, but it can still be see
|
|||||||
## Example
|
## Example
|
||||||
Prints an error why the website cannot be contacted:
|
Prints an error why the website cannot be contacted:
|
||||||
```lua
|
```lua
|
||||||
local myURL = "ws://this.website.does.not.exist"
|
local myURL = "wss://example.tweaked.cc/not-a-websocket"
|
||||||
http.websocketAsync(myURL)
|
http.websocketAsync(myURL)
|
||||||
local event, url, err
|
local event, url, err
|
||||||
repeat
|
repeat
|
||||||
|
@ -14,7 +14,7 @@ This event is normally handled by @{http.Websocket.receive}, but it can also be
|
|||||||
## Example
|
## Example
|
||||||
Prints a message sent by a WebSocket:
|
Prints a message sent by a WebSocket:
|
||||||
```lua
|
```lua
|
||||||
local myURL = "ws://echo.websocket.org"
|
local myURL = "wss://example.tweaked.cc/echo"
|
||||||
local ws = http.websocket(myURL)
|
local ws = http.websocket(myURL)
|
||||||
ws.send("Hello!")
|
ws.send("Hello!")
|
||||||
local event, url, message
|
local event, url, message
|
||||||
|
@ -15,7 +15,7 @@ This event is normally handled inside @{http.websocket}, but it can still be see
|
|||||||
## Example
|
## Example
|
||||||
Prints the content of a website (this may fail if the request fails):
|
Prints the content of a website (this may fail if the request fails):
|
||||||
```lua
|
```lua
|
||||||
local myURL = "ws://echo.websocket.org"
|
local myURL = "wss://example.tweaked.cc/echo"
|
||||||
http.websocketAsync(myURL)
|
http.websocketAsync(myURL)
|
||||||
local event, url, handle
|
local event, url, handle
|
||||||
repeat
|
repeat
|
||||||
|
@ -58,10 +58,10 @@ function request(...) end
|
|||||||
-- @treturn string A message detailing why the request failed.
|
-- @treturn string A message detailing why the request failed.
|
||||||
-- @treturn Response|nil The failing http response, if available.
|
-- @treturn Response|nil The failing http response, if available.
|
||||||
--
|
--
|
||||||
-- @usage Make a request to [example.computercraft.cc](https://example.computercraft.cc),
|
-- @usage Make a request to [example.tweaked.cc](https://example.tweaked.cc),
|
||||||
-- and print the returned page.
|
-- and print the returned page.
|
||||||
-- ```lua
|
-- ```lua
|
||||||
-- local request = http.get("https://example.computercraft.cc")
|
-- local request = http.get("https://example.tweaked.cc")
|
||||||
-- print(request.readAll())
|
-- print(request.readAll())
|
||||||
-- -- => HTTP is working!
|
-- -- => HTTP is working!
|
||||||
-- request.close()
|
-- request.close()
|
||||||
@ -123,7 +123,7 @@ function checkURLAsync(url) end
|
|||||||
--
|
--
|
||||||
-- @usage
|
-- @usage
|
||||||
-- ```lua
|
-- ```lua
|
||||||
-- print(http.checkURL("https://example.computercraft.cc/"))
|
-- print(http.checkURL("https://example.tweaked.cc/"))
|
||||||
-- -- => true
|
-- -- => true
|
||||||
-- print(http.checkURL("http://localhost/"))
|
-- print(http.checkURL("http://localhost/"))
|
||||||
-- -- => false Domain not permitted
|
-- -- => false Domain not permitted
|
||||||
|
@ -58,10 +58,10 @@ public class HttpResponseHandle implements ObjectSource
|
|||||||
* If multiple headers are sent with the same name, they will be combined with a comma.
|
* If multiple headers are sent with the same name, they will be combined with a comma.
|
||||||
*
|
*
|
||||||
* @return The response's headers.
|
* @return The response's headers.
|
||||||
* @cc.usage Make a request to [example.computercraft.cc](https://example.computercraft.cc), and print the
|
* @cc.usage Make a request to [example.tweaked.cc](https://example.tweaked.cc), and print the
|
||||||
* returned headers.
|
* returned headers.
|
||||||
* <pre>{@code
|
* <pre>{@code
|
||||||
* local request = http.get("https://example.computercraft.cc")
|
* local request = http.get("https://example.tweaked.cc")
|
||||||
* print(textutils.serialize(request.getResponseHeaders()))
|
* print(textutils.serialize(request.getResponseHeaders()))
|
||||||
* -- => {
|
* -- => {
|
||||||
* -- [ "Content-Type" ] = "text/plain; charset=utf8",
|
* -- [ "Content-Type" ] = "text/plain; charset=utf8",
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
Please report bugs at https://github.com/SquidDev-CC/CC-Tweaked. Thanks!
|
Please report bugs at https://github.com/SquidDev-CC/CC-Tweaked. Thanks!
|
||||||
View the documentation at https://wiki.computercraft.cc
|
View the documentation at https://tweaked.cc
|
||||||
Show off your programs or ask for help at our forum: https://forums.computercraft.cc
|
Show off your programs or ask for help at our forum: https://forums.computercraft.cc
|
||||||
You can disable these messages by running "set motd.enable false".
|
You can disable these messages by running "set motd.enable false".
|
||||||
Use "pastebin put" to upload a program to pastebin.
|
Use "pastebin put" to upload a program to pastebin.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user