Macros & Runtime variables

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, data: table)

This macro allows you to run code before the auth

  • func param must be a constant function not a variable function
  • 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

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

Do not put anything important in this function

Data table:

Field Type Default Description
obfuscate Boolean False Obfuscate the code in this function, will cost you an extra obfuscation, if you disable this the code will still be minified
async Boolean False Run the code async to the main script

Example code:

la_init(function()
	if game.PlaceId ~= 123456789 then
		game:GetService('Players').LocalPlayer:Kick('This script must be ran in GAME_NAME') -- main script wont run if player is kicked
	end

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

	while not keyProvided do -- when async is false this will stop the main script from loading, if async was true this wouldnt stop the main script
		task.wait()
	end
end, {
	obfuscate = false,
	async = false
})

Runtime variables

Runtime variables are variables LuaAuth provides your script

Do NOT modify any LuaAuth variables
LuaAuth will not let you upload your script if you attempt to modify any LuaAuth variables in it

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

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('your key expired in ' .. la_seconds_left .. 's')

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