Module unicorn.util

Index

Module

logging

Data

sandbox_env

A table containing "safe" functions that have no side effects outside of where they are used. @doctype const

Function

evaluateInSandbox()

Load some Lua code in a sandboxed environment. Scripts have access to any variable defined in unicorn.util.sandbox_env.

fileWrite()

smartHttp()

substituteInPlace()

Run string.gsub on a particular file

Api reference

unicorn.util.smartHttp(url: string): (The: string)
Parameters:

url (string) – A valid HTTP or HTTPS URL.

Returns:

The (string) – content from the request

unicorn.util.fileWrite(content: string, path: string): boolean
Parameters:
  • content (string) – The contents of the file to be written.

  • path (string) – The full path of the file to be written.

unicorn.util.sandbox_env: table

A table containing “safe” functions that have no side effects outside of where they are used. @doctype const

See unicorn.util.evaluateInSandbox()

unicorn.util.evaluateInSandbox(input: string): function

Load some Lua code in a sandboxed environment. Scripts have access to any variable defined in unicorn.util.sandbox_env.

See load

Parameters:

input (string) – Lua code to evaluate

unicorn.util.substituteInPlace(file: string, ...: The)

Run string.gsub on a particular file

See string.gsub

Parameters:
  • file (string) – The path to the file to operate on

  • ... (The) – parameters to pass to string.gsub