webmcp

view framework/env/__init.lua @ 286:fc2aba7d5db9

Code cleanup regarding loading of "multirand" library
author jbe
date Sun Mar 22 02:10:57 2015 +0100 (2015-03-22)
parents 46f0083889a9
children 1fbdccf4f8e9
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 (except "multirand", which must be loaded after forking)
41 extos = require 'extos'
42 nihil = require 'nihil'
43 mondelefant = require 'mondelefant'
44 mondelefant.connection_prototype.error_objects = true
45 atom = require 'atom'
46 json = require 'json'
47 require 'mondelefant_atom_connector'
48 -- NOTE: "multirand" library is loaded in mcp.lua after forking
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 --//--

Impressum / About Us