webmcp

diff framework/env/locale/_get_translation_table.lua @ 64:3d43a5cf17c1

Compatibility with Lua 5.2
author jbe
date Sun Apr 15 16:04:33 2012 +0200 (2012-04-15)
parents 9fdfb27f8e67
children 2cb27106aa73
line diff
     1.1 --- a/framework/env/locale/_get_translation_table.lua	Tue Apr 03 00:56:02 2012 +0200
     1.2 +++ b/framework/env/locale/_get_translation_table.lua	Sun Apr 15 16:04:33 2012 +0200
     1.3 @@ -9,8 +9,13 @@
     1.4        return translation_table
     1.5      end
     1.6      local filename = encode.file_path(request.get_app_basepath(), "locale", "translations." .. language_code .. ".lua")
     1.7 -    local func = assert(loadfile(filename))
     1.8 -    setfenv(func, {})
     1.9 +    local func
    1.10 +    if _ENV then
    1.11 +      func = assert(loadfile(filename), nil, {})
    1.12 +    else
    1.13 +      func = assert(loadfile(filename))
    1.14 +      setfenv(func, {})
    1.15 +    end
    1.16      translation_table = func()
    1.17      if type(translation_table) ~= "table" then
    1.18        error("Translation file did not return a table.")

Impressum / About Us