Detect on which platform you are running. (PC/moblie/Playstation/ect)

  • #1, by stothewFriday, 22. June 2018, 20:49 2 years ago
    Hi there,

    i play around with the different platforms we can export for...
    So as the title suggest we need some kind of detection on which platfrom we are to provide the right kind of "input interface". For example i compiled a Andriod version today and have no right click... an easy soulution would be to provide a verbcoin on Andriod, but i don´t want this for PC.. and as you guess the list goes on.
    So is there any function to detect the platform the programm is running?
    (if not there should be!) wink

    thanks!

    Forum Fan

    125 Posts


  • #2, by sebastianFriday, 22. June 2018, 20:59 2 years ago
    Hi stothew,

    use the getProperty Lua function to set some conditions. See here:

    kind regards
    Sebastian

    Thread Captain

    2337 Posts

  • #3, by afrlmeFriday, 22. June 2018, 21:01 2 years ago
    Actually, there is already a system in place for that. wink

    getProperty(name)

    1. “string” - The requested property to retrieve.
    2. Currently supported properties:
    3. “platform” (win,mac,ios,android,linux,ps4,xbox1,html5)
    4. “steam_initialized” (true/false depending if the steam_api was loaded and client is connected, false if the operation failed)
    5. “galaxy_initialized” (true/false depending if the gog galaxy_api was loaded and client is connected, false if the operation failed)
    6. “galaxy_ready” (true if the galaxy_api is ready)
    7. “system_language” Returns English name of system language or “unknown” if language could not be retrieved.
    8. “display_resolution” Returns the rect that is drawn in, subtracting the black borders

    -- if platform equals windows then do some action else if mac do some other action
    if getProperty("platform") == "win" then
      Conditions["win"].Value = true
    elseif getProperty("platform") == "mac" then
      Conditions["mac"].Value = true
    end
    1
    2
    3
    4
    5
    6
    7

    Imperator

    6846 Posts

  • #4, by afrlmeFriday, 22. June 2018, 21:04 2 years ago
    Don't seem to be able to edit my post to add a new line after the code block to add an edit note to say Sebastian beat me to it, though the wiki page is out of date. I took the information from Simon's luadocs api page instead.

    Imperator

    6846 Posts

  • #5, by stothewFriday, 22. June 2018, 23:09 2 years ago
    this is great! thanks a lot.

    Forum Fan

    125 Posts

Write post