From 57224ac89dac18c181ef1862b594ae8fbe7af961 Mon Sep 17 00:00:00 2001 From: kikito Date: Fri, 13 Sep 2013 13:56:53 +0200 Subject: [PATCH] updated readme --- README.md | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 8ea77a7..1a3919b 100644 --- a/README.md +++ b/README.md @@ -10,8 +10,7 @@ Usage local sandbox = require 'sandbox' -`sf = sandbox(f, options)` and `sf = sandbox.protect(f, options)` ------------------------------------------------------------------ +#### `sf = sandbox(f, options)` and `sf = sandbox.protect(f, options)` Those two are synonyms. They return a sandboxed version of `f`. @@ -33,7 +32,7 @@ Only safe modules and operations can be accessed from a sandboxed function. See f1() -- ok f2() -- error: os.execute not found -### `options.quota (default 500000)` +##### `options.quota` It is not possible to exhaust the machine with infinite loops; the following will throw an error after invoking 500000 instructions: @@ -43,7 +42,7 @@ The amount of instructions executed can be tweaked via the `quota` option (defau sandbox.run('while true do end', {quota=10000}) -- throw error after 10000 instructions -### `options.env (default {})` +##### `options.env` Use the `env` option to add additional variables to the environment @@ -57,8 +56,7 @@ The sandboxed code can also modify the sandboxed function. Make sure to securize assert(env.amount = 2) -`result = sandbox.run(f, options, ...)` ---------------------------------------- +#### `result = sandbox.run(f, options, ...)` `sandbox.run` sanboxes a function and executes it. `f` can be either a string or a function