Contact Us

CATEGORIES

Whoops…Nothing found

Try other keywords in your search

pixcHelper

 1 Minute

 0 Likes

 19 Views

The library extends the standard Lua functionality with a set of utility features for property handling, data processing, and general scripting support. It is available in every installation at the following path:

C:\Program Files\AV Stumpfl\Pixera\build_xxx\Avio\Scripts\Lua\pixcHelper.lua

The pixcHelper library provides utility functions for:
 
  • Property management via a client API
  • String and table utilities
  • Time/frame conversions
  • Validation helpers
  • Debugging (table dumping)

Initialization


require "pixcHelper"
self.helper = createPixcHelper(pixc,self())

Creates a new pixcHelper instance.

Parameters:

  • px : pixc
  • client (object): API client used for property access, e.g., self()

Returns:

  • helper (table): Instance with all pixcHelper methods

pixcHelper.isInitialized(obj)

Description:
Checks whether a helper instance is properly initialized.

Parameters:

  • obj (table)

Returns:

  • boolean

Property Functions

pixcHelper:getProperty(prop, default)

Description:
Retrieves a property from the client.

Parameters:

  • prop (string): Property name
  • default (string | number | optional)

Returns:

  • string | nil

Behavior:

  • If property does not exist:
    • Uses default if provided
    • Writes default back to client (if valid)
  • Converts numbers to strings before writing

pixcHelper:setProperty(prop, value)

Description:
Sets a property value.

Parameters:

  • prop (string)
  • value (string | number | nil)

Behavior:

  • nil → converted to empty string ""
  • Numbers → converted to string
  • Only strings are stored

pixcHelper:loadAllProperties(props)

Description:
Loads all client properties into a table.

Parameters:

  • props (table, optional)

Returns:

  • table

Behavior:

  • Iterates over all property names
  • Skips "Logo"
  • Converts values:
    • numeric strings → number
    • "true"/"false"boolean
  • Removes whitespace from property names

pixcHelper:addEmptyPropertyIfMissing(prop)

Description:
Creates an empty property if it does not exist.


pixcHelper:clearProperty(prop)

Description:
Clears a property (sets it to nil).


Callback

pixcHelper.wrapCallback(cb)

Description:
Wraps a callback function.

Parameters:

  • cb (function)

Returns:

  • function

Purpose:

  • Simple passthrough wrapper (can be used for API compatibility)

String Utilities

pixcHelper.stringSplit(s, sep, include_empty)

Description:
Splits a string into parts.

Parameters:

  • s (string | number)
  • sep (string, default " ")
  • include_empty (boolean)

Returns:

  • table

Notes:

  • Converts numbers to string
  • Supports empty fields (useful for CSV parsing)

pixcHelper.trim(str)

Description:
Trims whitespace on both sides.


pixcHelper.trimL(str)

Description:
Trims leading whitespace.


pixcHelper.trimR(str)

Description:
Trims trailing whitespace.


Boolean & Array Utilities

pixcHelper.toBool(str, default)

Description:
Converts a value to boolean.

Parameters:

  • str (string | number | boolean)
  • default (boolean)

Returns:

  • boolean

Rules:

  • "true" / 1true
  • "false" / 0false
  • otherwise → default

pixcHelper.dedupArray(data)

Description:
Removes duplicate values from an array.

Parameters:

  • data (table)

Returns:

  • table

Notes:

  • Order is not preserved

Debugging

pixcHelper.dump(obj, indent_size)

Description:
Pretty-prints any Lua value (including nested tables).

Parameters:

  • obj (any)
  • indent_size (number, default = 2)

Returns:

  • string

Features:

  • Handles nested tables
  • Detects cycles
  • Sorts keys for deterministic output
  • Formats functions and unknown types

Validation

pixcHelper.isValidFunctionName(name)

Description:
Checks if a string is a valid Lua function name.

Returns:

  • boolean

pixcHelper.isValidIP(ip)

Description:
Validates an IPv4 address.

Returns:

  • boolean

Rules:

  • Format: x.x.x.x
  • Each octet: 0–255

pixcHelper.isValidPort(port)

Description:
Validates a TCP/UDP port.

Returns:

  • boolean

Range:

  • 1–65535

Time / Frame Conversions

pixcHelper.framesToHmsf(frames, fps)

Description:
Converts frame count to timecode string.

Format:

HH:MM:SS:FF

Returns:

  • string

pixcHelper.framesToHmsfTable(frames, fps)

Description:
Same as above, but returns a table.

Returns:

  • string

"hour":"minute":"second":"frame"

 

pixcHelper.HmsfToFrames(hmsf, fps)

Description:
Converts timecode string back to frame count.

Parameters:

  • hmsf (string "HH:MM:SS:FF")
  • fps (number)

Returns:

  • number

Module Return

Returns:

return pixcHelper

PIXERA 26.2 INTER  43 | 25. March 2026 | J.B.

Was this article helpful?