Difference between revisions of "love.system.openURL"
(Created page) |
m (Fixed example) |
||
Line 29: | Line 29: | ||
if key == "s" then | if key == "s" then | ||
-- To open a file or folder, "file://" must be prepended to the path. | -- To open a file or folder, "file://" must be prepended to the path. | ||
− | love. | + | love.system.openURL("file://"..love.filesystem.getSaveDirectory()) |
end | end | ||
end | end |
Revision as of 00:48, 1 April 2014
Available since LÖVE 0.9.1 |
This function is not supported in earlier versions. |
Opens a URL with the user's web or file browser.
Contents
Function
Synopsis
success = love.system.openURL( url )
Arguments
string url
- The URL to open. Must be formatted as a proper URL.
Returns
boolean success
- Whether the URL was opened successfully.
Examples
Open love2d.org when the game is loaded.
function love.load()
love.system.openURL("http://love2d.org/")
end
Open the game's save directory when "s" is pressed.
function love.load()
-- Make sure the save directory exists by writing an empty file.
love.filesystem.write("test.txt", "")
end
function love.keypressed(key)
if key == "s" then
-- To open a file or folder, "file://" must be prepended to the path.
love.system.openURL("file://"..love.filesystem.getSaveDirectory())
end
end
See Also
Other Languages
Dansk –
Deutsch –
English –
Español –
Français –
Indonesia –
Italiano –
Lietuviškai –
Magyar –
Nederlands –
Polski –
Português –
Română –
Slovenský –
Suomi –
Svenska –
Türkçe –
Česky –
Ελληνικά –
Български –
Русский –
Српски –
Українська –
עברית –
ไทย –
日本語 –
正體中文 –
简体中文 –
Tiếng Việt –
한국어
More info