webmcp

view framework/env/locale/do_with.lua @ 57:6a830c1479b0

Removed doubled "end" leading to parsing error
author bsw
date Sun Dec 18 22:14:03 2011 +0100 (2011-12-18)
parents 9fdfb27f8e67
children c3d539e33710
line source
1 --[[--
2 locale.do_with(
3 locale_options, -- table with locale information (as if passed to locale.set(...))
4 function()
5 ... -- code to be executed with the given locale settings
6 end
7 )
9 This function executes code with temporarily changed locale settings. See locale.set(...) for correct usage of 'locale_options'.
11 --]]--
13 function locale.do_with(locale_options, block)
14 local old_data = {}
15 for key, value in pairs(locale._current_data) do
16 old_data[key] = value
17 end
18 locale.set(locale_options)
19 block()
20 old_data.reset = true
21 locale.set(old_data)
22 end

Impressum / About Us