Difference between revisions of "Lua:getInternet"
m (Added CodeBox Template.) |
|||
| Line 1: | Line 1: | ||
[[Category:Lua]] | [[Category:Lua]] | ||
| − | '''function''' getInternet('' | + | {{CodeBox|'''function''' getInternet(''clientName'') ''':''' Internet}} |
| − | Returns an | + | Returns an Internet client object for performing HTTP/HTTPS requests. The provided string selects the client implementation (for example <code>"ce"</code> or other registered client names). The returned object exposes convenience methods such as <code>getURL</code> to fetch a URL. |
| − | |||
| − | |||
| − | < | ||
| − | |||
| − | |||
| − | |||
| − | </ | ||
===Function Parameters=== | ===Function Parameters=== | ||
| − | {|width="85%" cellpadding="10 | + | {|width="85%" cellpadding="10" cellspacing="0" border="0" |
!align="left"|Parameter | !align="left"|Parameter | ||
!align="left"|Type | !align="left"|Type | ||
!style="width: 80%;background-color:white;" align="left"|Description | !style="width: 80%;background-color:white;" align="left"|Description | ||
|- | |- | ||
| − | | | + | | clientName |
| − | |string | + | | string |
| − | | | + | | Name of the Internet client to obtain (e.g. <code>"ce"</code>). Use a registered client name supported by your Cheat Engine build or installed plugins. |
|} | |} | ||
| + | ===Returns=== | ||
| + | Internet — An Internet class object (client) with methods for network requests. If the requested client cannot be created or found, the function may return <code>nil</code> or raise an error depending on the environment. | ||
| + | |||
| + | ===Description=== | ||
| + | Creates (or returns) an Internet client object that provides methods to perform common network operations, such as fetching a URL. Exact available methods depend on the client implementation; common methods include: | ||
| + | - <code>getURL(url)</code> — fetches the content at the given URL and returns it as a string (or a result object). | ||
| + | - <code>post(url, data)</code> — posts data to a URL (if supported). | ||
| + | |||
| + | Behavior and available methods may vary between Cheat Engine builds and installed extensions. Check the specific client documentation or test the returned object's methods at runtime. | ||
| + | |||
| + | ===Examples=== | ||
| + | <syntaxhighlight lang="Lua"> | ||
| + | -- Obtain the default Cheat Engine internet client and fetch a page | ||
| + | local int = getInternet("ce") | ||
| + | if int then | ||
| + | local result = int.getURL("http://www.google.com") | ||
| + | print(result) | ||
| + | else | ||
| + | print("Internet client 'ce' not available") | ||
| + | end | ||
| + | </syntaxhighlight> | ||
{{LuaSeeAlso}} | {{LuaSeeAlso}} | ||
Latest revision as of 18:53, 5 December 2025
| <> Function function getInternet(clientName) : Internet |
Returns an Internet client object for performing HTTP/HTTPS requests. The provided string selects the client implementation (for example "ce" or other registered client names). The returned object exposes convenience methods such as getURL to fetch a URL.
Function Parameters[edit]
| Parameter | Type | Description |
|---|---|---|
| clientName | string | Name of the Internet client to obtain (e.g. "ce"). Use a registered client name supported by your Cheat Engine build or installed plugins.
|
Returns[edit]
Internet — An Internet class object (client) with methods for network requests. If the requested client cannot be created or found, the function may return nil or raise an error depending on the environment.
Description[edit]
Creates (or returns) an Internet client object that provides methods to perform common network operations, such as fetching a URL. Exact available methods depend on the client implementation; common methods include:
- getURL(url) — fetches the content at the given URL and returns it as a string (or a result object).
- post(url, data) — posts data to a URL (if supported).
Behavior and available methods may vary between Cheat Engine builds and installed extensions. Check the specific client documentation or test the returned object's methods at runtime.
Examples[edit]
-- Obtain the default Cheat Engine internet client and fetch a page
local int = getInternet("ce")
if int then
local result = int.getURL("http://www.google.com")
print(result)
else
print("Internet client 'ce' not available")
endSee also[edit]
| Lua |
| Script Engine |