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: