MSK Scripts
TebexGithubDiscordMusiker15
  • MSK Scripts
    • Welcome
  • Common Issues
    • Keymaster
  • Miscellaneous
    • Change Notifications
  • Scripts
    • MSK Core
      • Installation
      • Functions
        • Client
          • Ace Permission
          • Commands
          • Coords
          • Player
          • Points
          • Request
          • Scaleform
          • UI
            • Input
            • Numpad
            • Progressbar
            • TextUI
          • Vehicle
        • Shared
          • String
          • Math
          • Table
          • Timeout
          • Vector
        • Server
          • Ace Permission
          • Ban System
          • Commands
          • Player
          • Scaleform
          • UI
            • Input
            • Numpad
            • Progressbar
            • TextUI
    • MSK Banking
      • Installation
        • Paycheck Transaction
      • Config
      • Exports
        • Client
        • Server
      • Events
        • Client
        • Server
      • Server Callbacks
    • MSK EngineToggle
      • Guides
      • Exports
        • Client
      • Event Handler
        • Client
        • Server
    • MSK Fuel
      • Config
      • Exports
        • Client
    • MSK Garage
      • Config
      • Exports
        • Client
    • MSK Handcuffs
      • Guides
        • General Edits for Jobs
        • Jaksam Job Creator
        • Multichar
        • ox_inventory
      • Config
      • Admin Commands
      • Exports
        • Client
        • Server
      • Events
        • Client
        • Server
      • Event Handlers
    • MSK Radio
      • Config
      • Exports
        • Client
        • Server
      • Events
        • Server
    • MSK Simcard
      • Installation
        • Config.Database
      • Config
    • MSK VehicleKeys
      • Guides
        • Installation
        • Integrations
      • Config
      • Admin Commands
      • Exports
        • Client
        • Server
    • MSK Whitelist
      • Config
      • Exports
        • Client
        • Server
    • MSK Weaponammo
Powered by GitBook
On this page
  • MSK.Table.Contains
  • MSK.Table.Dump
  • MSK.Table.Size
  • MSK.Table.Find
  1. Scripts
  2. MSK Core
  3. Functions
  4. Shared

Table

MSK.Table.Contains

Check if a value contains in a table

Parameters tbl - table - The Table to check value - string/table - The Value/s to check

Returns contains - boolean - Whether the value contains in the table

local tbl = {'value_1', 'value_2'}

-- Checks if the value contains in the table
local contains = MSK.Table.Contains(tbl, 'value_1')

-- Checks if one of the values contains in the table
local contains = MSK.Table.Contains(tbl, {'value_1', 'value_5'})

-- As an Export:
local contains = exports.msk_core:TableConatins(tbl, value)

MSK.Table.Dump

Dumps the given table to a readable string with a tree structure.

Parameters tbl - table - The Table that should be dumped

Returns text - string - The formatted text of the given table

local tbl = {
  ['test'] = {name = 'test', action = '123'},
  test2 = {name = 'test2', action = 456},
}

print(MSK.Table.Dump(tbl))

-- Output:
{
  ["test"] = {
    ["action"] = '123',
    ["name"] = test,
  },
  ["test2"] = {
    ["action"] = 456,
    ["name"] = test2,
  },
}

-- As an Export:
local number = exports.msk_core:TableDump(table, value)

MSK.Table.Size

Get the size of the table

Parameters tbl - table - The Table that should be checked

Returns size - number - The size of the table

local tbl = {
  ['test'] = {name = 'test', action = '123'},
  test2 = {name = 'test2', action = 456},
}

local size = MSK.Table.Size(tbl) -- Output: 2

MSK.Table.Find

Find a specific value in a index table

Parameters tbl - table - The Table that should be checked

Returns index - number? - The index of the given value value - number/string/table - The value of the given value

local index, value = MSK.Table.Find(tbl, value)

local tbl = {
  [1] = {'123'},
  [2] = {456},
}

local index, value = MSK.Table.Find(tbl, '123') -- Output: 1, '123'
local index, value = MSK.Table.Find(tbl, 456) -- Output: 2, 456
local index, value = MSK.Table.Find(tbl, 'Hello World') -- Output: nil, 'Hello World'

Last updated 7 months ago