Skip to content

Latest commit

 

History

History
60 lines (41 loc) · 1.36 KB

File metadata and controls

60 lines (41 loc) · 1.36 KB

permission

Summary

geode.utils.permission reads and requests operating system permissions. This matters on mobile. On Windows and macOS, accepted permissions return granted. Use the Permission table for the values. A bad permission value raises a Lua error.

Name Value
ReadAllFiles 3
RecordAudio 4

getPermissionStatus

geode.utils.permission.getPermissionStatus(permission: number) -> boolean

Returns whether the permission is granted.

requestPermission

geode.utils.permission.requestPermission(permission: number, callback: (granted: boolean) -> ()) -> ()

Asks the system for the permission. The callback runs later on the main thread with the result. See Getting started for the shared runtime threading rule.

Permission

geode.utils.permission.Permission -> { ReadAllFiles: number, RecordAudio: number }

A table of the permission values.

Example

local perm = geode.utils.permission

if not perm.getPermissionStatus(perm.Permission.RecordAudio) then
    perm.requestPermission(perm.Permission.RecordAudio, function(granted)
        print("granted:", granted)
    end)
end

Related

Source

  • src/bindings/geode/GeodeSmallBindings.cpp