Module cream.util

Utility functions

Author:

David Delassus <david.jose.delassus@gmail.com>

Functions

eval (s) Eval Lua code
quit (...) Exit Cream-Browser
spawn (cmd) Spawn a program
spawn_shell (cmd) Spawn a program using the shell
table.clone (t) Clone a table
table.hasitem (t, item) Check if a table has an item and return its key
table.join (args) Join all tables given as parameters This will iterate all tables and insert all their keys into a new table
table.keys (t) Get a sorted table with all integer keys from a table
table.keys_filter (t, ...) Filter a tables keys for certain content types
table.reverse (t) Reverse a table


Functions

eval (s)
Eval Lua code

Parameters

  • s: Lua code to parse

Return value:

The return value of the Lua code.
quit (...)
Exit Cream-Browser

Parameters

  • ...: Exit Code (if needed)
spawn (cmd)
Spawn a program

Parameters

  • cmd: The command to run

Return value:

The new PID
spawn_shell (cmd)
Spawn a program using the shell

Parameters

  • cmd: The command to run.

Return value:

The new PID
table.clone (t)
Clone a table

Parameters

  • t: the table to clone

Return value:

a clone of t
table.hasitem (t, item)
Check if a table has an item and return its key

Parameters

  • t: The table
  • item: The item to look for in values of the table

Return value:

The key were the item is found, or nil if not found
table.join (args)
Join all tables given as parameters This will iterate all tables and insert all their keys into a new table

Parameters

  • args: A list of tables to join

Return value:

A new table containing all keys from the arguments.
table.keys (t)
Get a sorted table with all integer keys from a table

Parameters

  • t: the table for which the keys to get

Return value:

A table with keys
table.keys_filter (t, ...)
Filter a tables keys for certain content types

Parameters

  • t: The table to retrieve the keys for
  • ...: the types to look for

Return value:

A filtered table with keys
table.reverse (t)
Reverse a table

Parameters

  • t: the table to reverse

Return value:

the reversed table

Valid XHTML 1.0!