Macros & Runtime variables

Do NOT modify any LuaAuth variables & macros
LuaAuth will not let you upload your script if you attempt to modify any of our macros & variables

if you need to set fake variables for development check out la_exists

Macros

Macros are like custom functions you can use in your script

Syntax: la_secure_request(data: table): table

This macro is used exactly like the regular http.request
It prevents users from viewing and modifying the request in app

This cannot stop users from viewing the request externally

Return data:

Example code:

local data = la_secure_request({
    Url = 'https://luaauth.com',
    Method = 'GET'
})

if not data.success then
    return print('request failed due to ' .. data.reason)
end

print('request returned ' .. data.response.Body)

Syntax: la_secure_kick(message: string)

This macro kicks the player with the provided message, and crashes their game if they attempt to use an anti kick

Example code:

if not authenticated then
	la_secure_kick('failed to authenticate user')
end

Syntax: la_init(func: const function, obfuscate: boolean)

This macro allows you to run code before the auth

  • • func param must be a constant function not a variable function
  • • func must return true for the script to continue loading
  • • This macro can only be used once per script
  • • The code inside this macro is extracted out into a separate file, so it cannot reference anything outside it
  • • if obfuscate is enabled then it will cost 1 extra obfuscation
  • • if obfuscate is disabled your code will still be minified

The code in this function will be run before the auth, meaning anyone can copy, view (unless obfuscated) or use the code

Do not put anything important or private in this function!!

Example code:

la_init(function()
	if game.PlaceId ~= 123456789 then
		return false -- main script wont run if init returns false
        -- init script can be easily modified so do not place critical logic here
	end

	local keyProvided = false
	-- you could add a custom enter key ui here, then set keyProvided = true when done

	while not keyProvided do task.wait() end
    return true
end, false)

Runtime variables

Runtime variables are variables LuaAuth provides your script

type: Boolean

returns True when script is running through LuaAuth
Allows you to modify LuaAuth variables for development without causing, check example below

Example code:

if not la_exists then -- Editing LuaAuth variables wont error when uploading to LuaAuth if inside this
	la_is_premium = true
    la_discord_id = '01234567890123456'
    la_script_name 'example'
end

type: Boolean

Use to check if the user has a key or not.

For FFA users this variable will be False
For regular users this variable will be True

Example code:

if la_is_premium then
    print('loading premium script..')
else
    print('loading FFA script..')
end

type: Number

The amount of executions for this user
Also works with FFA users

Example code:

print('you have run the script ' .. la_executions .. ' times')

type: String Nullable

The users linked discord id, if they have one

Example code:

print('linked discord: ' .. la_discord_id)

type: Number Nullable

The amount of seconds left until a users key expires
Will be Null for FFA users or permanent keys

Example code:

print('your key expired in ' .. la_seconds_left .. 's')

type: String Nullable

The users note,
Will be Null for FFA users or users without a note

Example code:

print('whitelist reason: ' .. la_user_note)

if la_user_note == 'beta' then
    print('loading beta script...')
end

type: String

The name of the current script

Example code:

print('currently using script ' .. la_script_name)

type: Boolean

Use to check if the user supports our custom sessions feature (some executors dont support it)

Example code:

if la_supports_sessions then
    print('setting up sessions')
else
    print('sessions unsupported, skipping setup')
end

type: Boolean

Use to check if the users key is from the ad system or not
Returns False for FFA users

Example code:

if not la_is_ad_key then
    print('loading premium only features..')
end

type: String

The users discord name
Returns "N/A" if user doesnt have a linked discord

Example code:

print('hello ' .. la_discord_name)

type: String

The users discord display name
Returns "N/A" if user doesnt have a linked discord

Example code:

print('hello ' .. la_discord_display_name)

type: String Nullable

A url for the users avatar image
Will be Null if user doesnt have a linked discord or if they dont have an avatar

Example code:

if la_discord_avatar then
    setProfileImage(la_discord_avatar)
end

type: String Nullable

A url for the users banner image
Will be Null if user doesnt have a linked discord or if they dont have a banner

Example code:

if la_discord_banner then
    setMenuBackground(la_discord_banner)
end

type: Number Nullable

A base10 number representing the users profile color.

Discord API is a little weird,

  • • for non nitro users this is their banner color
  • • for nitro users this is their primary gradient color

Will be Null if user doesnt have a linked discord

Example code:

if la_discord_profile_color then
    setMenuColor(la_discord_profile_color)
end