Shared

Export(s) available for use on the client & server.

getPlayerData

Retrieves player data. Optionally, you can pass a string to get a specific piece of data.

Syntax

Client

exports.lation_coke:getPlayerData(key)
  • key (optional, string): The specific player data field you want to retrieve (e.g., "level", "exp", "gas_inputs"). If omitted, returns a table with all player data.

Server

exports.lation_coke:getPlayerData(source, key)
  • source (required, number): The player’s source
  • key (optional, string): The specific player data field you want to retrieve (e.g., "level", "exp", "gas_inputs"). If omitted, returns a table with all player data.

Returns

  • If key is provided; returns the value of the specified data field.
  • If key is not provided; returns a table containing all player data fields.

Examples

client.lua
local data = exports.lation_coke:getPlayerData()
print('All player data: ', json.encode(data, {indent=true}))
 
local level = exports.lation_coke:getPlayerData('level')
print('Player\'s level: ', level)
server.lua
local source = 1 -- Replace with player's source
 
local data = exports.lation_coke:getPlayerData(source)
print('All player data: ', json.encode(data, {indent=true}))
 
local level = exports.lation_coke:getPlayerData(source, 'level')
print('Player\'s level: ', level)

getPlantData

Retrieves plant data.

Syntax

Shared

exports.lation_coke:getPlantData(plantId)
  • plantId (required, number): The plant ID you want to retrieve data for.

Returns

  • A table containing all plant data.

Examples

client.lua
local data = exports.lation_coke:getPlantData(plantId)
print('All plant data: ', json.encode(data, {indent=true}))
server.lua
local data = exports.lation_coke:getPlantData(plantId)
print('All plant data: ', json.encode(data, {indent=true}))

getTableData

Retrieves table data.

Syntax

Shared

exports.lation_coke:getTableData(tableId)
  • tableId (required, number): The table ID you want to retrieve data for.

Returns

  • A table containing all table data.

Examples

client.lua
local data = exports.lation_coke:getTableData(tableId)
print('All table data: ', json.encode(data, {indent=true}))
server.lua
local data = exports.lation_coke:getTableData(tableId)
print('All table data: ', json.encode(data, {indent=true}))

getLabData

Retrieves lab data.

Syntax

Shared

exports.lation_coke:getLabData(labId)
  • labId (required, number): The lab ID you want to retrieve data for.

Returns

  • A table containing all table data.

Examples

client.lua
local data = exports.lation_coke:getLabData(labId)
print('All table data: ', json.encode(data, {indent=true}))
server.lua
local data = exports.lation_coke:getLabData(labId)
print('All table data: ', json.encode(data, {indent=true}))

getAllLabs

Retrieves all labs data.

Syntax

Shared

exports.lation_coke:getAllLabs()

Returns

  • A table containing all labs data.

Examples

client.lua
local data = exports.lation_coke:getAllLabs()
print('All labs data: ', json.encode(data, {indent=true}))
server.lua
local data = exports.lation_coke:getAllLabs()
print('All labs data: ', json.encode(data, {indent=true}))

getUserPermissions

Returns a table containing true or false for each permission the user has in a specific lab.

Syntax

Client

exports.lation_coke:getUserPermissions(labId)
  • labId (required, number): The lab ID you want to get permissions for.

Server

exports.lation_coke:getUserPermissions(source, labId)
  • source (required, number): The player’s source
  • labId (required, number): The lab ID you want to get permissions for.

Returns

  • A table containing the user’s permissions for the specified lab.

Examples

client.lua
local permissions = exports.lation_coke:getUserPermissions(labId)
print('User permissions: ', json.encode(permissions, {indent=true}))
server.lua
local permissions = exports.lation_coke:getUserPermissions(source, labId)
print('User permissions: ', json.encode(permissions, {indent=true}))

isLabAvailable

Returns true or false if the lab is available for sale.

Syntax

Shared

exports.lation_coke:isLabAvailable(labId)
  • labId (required, number): The lab ID you want to check.

Returns

  • A boolean if the lab is available for sale (true or false).

Examples

client.lua
local isLabAvailable = exports.lation_coke:isLabAvailable(labId)
if isLabAvailable then
    print('Yes, this lab is available for sale')
else
    print('No, this lab is NOT available for sale')
end
server.lua
local isLabAvailable = exports.lation_coke:isLabAvailable(labId)
if isLabAvailable then
    print('Yes, this lab is available for sale')
else
    print('No, this lab is NOT available for sale')
end

isOwner

Returns true or false if the player is the owner of the lab.

Syntax

Client

exports.lation_coke:isOwner(labId)
  • labId (required, number): The lab ID you want to check.

Server

exports.lation_coke:isOwner(source, labId)
  • source (required, number): The player’s source
  • labId (required, number): The lab ID you want to check.

Returns

  • A boolean if player is owner (true or false).

Examples

client.lua
local isOwner = exports.lation_coke:isOwner(labId)
if isOwner then
    print('Player is the owner of this lab')
else
    print('Player is NOT the owner of this lab')
end
server.lua
local isOwner = exports.lation_coke:isOwner(source, labId)
if isOwner then
    print('Player is the owner of this lab')
else
    print('Player is NOT the owner of this lab')
end

isAuthUser

Returns true or false if the player is an authorized user of the lab.

Syntax

Client

exports.lation_coke:isAuthUser(labId)
  • labId (required, number): The lab ID you want to check.

Server

exports.lation_coke:isAuthUser(source, labId)
  • source (required, number): The player’s source
  • labId (required, number): The lab ID you want to check.

Returns

  • A boolean if player is an authorized user (true or false).

Examples

client.lua
local isAuthUser = exports.lation_coke:isAuthUser(labId)
if isAuthUser then
    print('Player is an authorized user of this lab')
else
    print('Player is NOT an authorized user of this lab')
end
server.lua
local isAuthUser = exports.lation_coke:isAuthUser(source, labId)
if isAuthUser then
    print('Player is an authorized user of this lab')
else
    print('Player is NOT an authorized user of this lab')
end

Client

Export(s) available for use on the client only.

openLabShop

Opens the lab dealer menu showing available labs.

Syntax

Client

exports.lation_coke:openLabShop()

Examples

client.lua
exports.lation_coke:openLabShop()
print('You opened the lab dealer shop!')

isInsideLab

Returns true or false if the player is inside a lab and the lab ID.

Syntax

Client

exports.lation_coke:isInsideLab()

Returns

  • A boolean if player is inside a lab (true or false).
  • A number (the lab ID they are in, if applicable) or nil.

Examples

client.lua
local isInside, labId = exports.lation_coke:isInsideLab()
print('Is player inside a lab? ', tostring(isInside))
print('Which lab (ID) are they in? ', tostring(labId))

Server

Export(s) available for use on the server only.

addPlayerData

Adds an amount to a player’s specified data field.

Syntax

Server

exports.lation_coke:addPlayerData(source, dataType, amount)
  • source (required, number): The player’s source
  • dataType (required, string): The data field to modify (e.g., "level", "exp", etc)
  • amount (required, number): The amount to add to the specified data field

Examples

server.lua
local source = 1 -- Replace with player's source
exports.lation_coke:addPlayerData(source, 'exp', 100)
print('Added +100 XP to player!')
 
exports.lation_coke:addPlayerData(source, 'bricks', 1)
print('Added +1 to player\'s total bricks produced!')