Skip to content

Utils functions Shared

A library with util functions to create a script

JO Functions

jo.utils.convertToTable()

A function to convert a value to table if it's not already a table

Syntax

lua
jo.utils.convertToTable(value, key)

Parameters

value : any

The value to move inside a table

key : string

The key of the value inside the new table

Return Value

Type : table

The new table with

Example

lua
local hash = 12345
local data = jo.utils.convertToTable(hash,"myHash")
print(json.encode(data))
-- Expected ouput: {"myHash":12345}

Last updated: