Cannot detect if Steam initialised correctly
Given the following code (a variation on what is provided in the documentation):
local status, error = pcall(steam.init)
if not status then
print("Steam Error: " .. error)
return
else
print("Steam init success")
end
When Steam is not running, the following is output to the console
[S_API] SteamAPI_Init(): SteamAPI_IsSteamRunning() did not locate a running instance of Steam.
[S_API] SteamAPI_Init(): Loaded '/home/domarius/.local/share/Steam/linux64/steamclient.so' OK.
DEBUG:SCRIPT: Steam init success
You shouldn't do a pcall here. steam.init() will not throw a Lua error but instead return two values, the first is a boolean which indicates if steam was successfully initialized, and the other is nil on success and an error message if init failed.
https://github.com/defold/extension-steam/blob/master/examples/menu/menu.gui_script#L4-L10
Oh, can we correct the documentation then? This is the documentation;
function init(self)
-- initialize the Steamworks SDK
local status, error = pcall(steam.init)
if not status then
print("Error: " .. error)
return
end
steam.set_listener(on_steam_event)
end
See here
Oh, sure, could you please submit a pull request with the fix for the docs?
https://github.com/defold/extension-steam/tree/master/docs