webmcp
view framework/env/__init.lua @ 277:2ddbb44680f7
Bugfix/code-cleanup regarding initializers/finalizers: correctly detect yield-values and remove finalizers upon execution
| author | jbe | 
|---|---|
| date | Sat Mar 21 17:24:27 2015 +0100 (2015-03-21) | 
| parents | 46f0083889a9 | 
| children | fc2aba7d5db9 | 
 line source
     1 -- string localization function
     2 function _(text, replacements)
     3   local text = locale._get_translation_table()[text] or text
     4   if replacements then
     5     return (
     6       string.gsub(
     7         text,
     8         "#{(.-)}",
     9         function (placeholder)
    10           return replacements[placeholder]
    11         end
    12       )
    13     )
    14   else
    15     return text
    16   end
    17 end
    19 --[[--
    20 cloned_table =  -- newly generated table
    21 table.new(
    22   table_or_nil  -- keys of a given table will be copied to the new table
    23 )
    25 If a table is given, then a cloned table is returned.
    26 If nil is given, then a new empty table is returned.
    28 --]]--
    29 function table.new(tbl)
    30   local new_tbl = {}
    31   if tbl then
    32     for key, value in pairs(tbl) do
    33       new_tbl[key] = value
    34     end
    35   end
    36   return new_tbl
    37 end
    38 --//--
    40 -- load libraries
    41 extos       = require 'extos'
    42 nihil       = require 'nihil'
    43 --multirand   = require 'multirand'  -- TODO: load after forking
    44 mondelefant = require 'mondelefant'
    45 mondelefant.connection_prototype.error_objects = true
    46 atom        = require 'atom'
    47 json        = require 'json'
    48 require 'mondelefant_atom_connector'
    50 --[[--
    51 config  -- table to store application configuration
    53 'config' is a global table, which can be modified by a config file of an application to modify the behaviour of that application.
    54 --]]--
    55 config = {}
    56 --//--
