Skip to content

Latest commit

 

History

History
61 lines (42 loc) · 1.55 KB

File metadata and controls

61 lines (42 loc) · 1.55 KB

permission

Summary

geode.utils.permission reads and requests operating system permissions. This matters on mobile. On Windows and macOS every permission reports granted. On Android and iOS the system decides. On iOS, ReadAllFiles is always denied. Android shows the system dialog for RecordAudio. A bad permission value raises a Lua error. Use the Permission table for the values.

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
  • tools/luau_codegen/emit/luau_types/manual_fields.py