webmcp

view framework/env/__init.lua @ 206:eb3e236d261d

Code cleanup and work on Moonbridge integration
author jbe
date Fri Jan 09 22:28:39 2015 +0100 (2015-01-09)
parents c6ef9991b911
children 77c4774e8342
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 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'
44 mondelefant = require 'mondelefant'
45 mondelefant.connection_prototype.error_objects = true
46 atom = require 'atom'
47 json = require 'json'
48 require 'mondelefant_atom_connector'
49 http = require 'http'
51 --[[--
52 app -- table to store an application state
54 'app' is a global table for storing any application state data
55 --]]--
56 app = {}
57 --//--
59 --[[--
60 config -- table to store application configuration
62 'config' is a global table, which can be modified by a config file of an application to modify the behaviour of that application.
63 --]]--
64 config = {}
65 --//--

Impressum / About Us