-
Notifications
You must be signed in to change notification settings - Fork 87
SMODS.https
WilsontheWolf edited this page Feb 25, 2025
·
1 revision
The SMODS.https module is a module designed to be compatible with the lua-https module. The main difference between this and the built in https module is that SMODS.https
works on more platforms out of the box, compared to Balatro's shipped https modules (which is only availible on Windows by default).
To use this module you must first require
it, like so:
local https = require "SMODS.https"
-
https.request(url, options) -> code, body, headers
-
url
: The URL to request. -
options
: Additional optional options for the request.-
headers
: Additional headers to add to the request as key-value pairs. -
method
(One of"GET"|"POST"|"HEAD"|"PUT"|"DELETE"|"PATCH"
): HTTP method. If absent, it's either "GET" or "POST" depending on the data field. -
data
: Optional additional data to send as application/x-www-form-urlencoded (unless specified otherwise in Content-Type header). - Return values:
-
code
: HTTP status code, or 0 on failure. -
body
: The response body on success. Either nil or a description of the error on failure. -
headers
: HTTP response headers as key-value pairs, or nil on failure.
-
-
-
-
https.asyncRequest(url, optionsOrCallback, callback)
-
url
: The URL to request. -
optionsOrCallback
: If callback is nil, this can be set to a function instead of the callback. Otherwise is treated like option (seehttp.request
) -
callback
: A function to call when the request is done, or nil if the callback is set inoptionsOrCallback
.-
callback(code, body, headers)
- The callback to call. For meanings on the values, seehttp.request
's return values
-
-
local https = require "SMODS.https"
print(https.request("https://example.com")) -- Sync request
https.asyncRequest("https://example.com", print)) -- Async request
Game Objects
- API Documentation
- SMODS.Achievement
- SMODS.Atlas
- SMODS.Blind
- SMODS.Center
- SMODS.Challenge
- SMODS.DeckSkin
- SMODS.https
- SMODS.Keybind
- SMODS.Language
- SMODS.ObjectType
- SMODS.PokerHand
- SMODS.Rarity
- SMODS.Seal
- SMODS.Sound
- SMODS.Stake
- SMODS.Sticker
- SMODS.Suit and SMODS.Rank
- SMODS.Tag
Guides
- Your First Mod
- Mod Metadata
- Calculate Functions
- Logging
- Event Manager
- Localization
- Mod functions
- UI Structure
- Utility Functions
Found an issue, or want to add something? Submit a PR to the Wiki repo.