Custom token ui
info
LuaAuth provides a macro to replace our default token ui with a custom one
warning
- This macro can only be used once in your script
- The code inside this macro is extracted out, meaning you cant reference anything outside this function from within it
- This function will only be called once per user max and only if the user is missing a cached token
- This function is run async to the main script
- The function passed MUST be a constant, meaning you cant do something like
la_token_ui(myFunc)
How to use it
syntax: la_token_ui(func: constant function)
func is a constant function
Function arguments
info
We will pass 1 argument to your func arg.
It is a function used to verify the token the user provides
syntax: checkToken(token: string)
warning
- Calling this is the only way to resume loading the main script
- No data is returned and this function can only be called once
Example
la_token_ui(function(checkToken) -- dont forget you can name this argument anything you want, doesnt have to be "checkToken"
local uiLib = loadstring(...)()
uiLib:createTokenMenu()
local con
con = uiLib.onComplete:Connect(function(token)
if token == '' then return end
checkToken(token) -- the main script will resume loading instantly after calling this
-- dont forget to cleanup and remove everything when done
con:Disconnect()
uiLib:removeTokenMenu()
end)
end)