Skip to content

Commit

Permalink
Uglify on serialize_to_file
Browse files Browse the repository at this point in the history
  • Loading branch information
yagop committed Apr 15, 2015
1 parent 1c618ad commit 12a56a0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
3 changes: 1 addition & 2 deletions bot/bot.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require("./bot/utils")

VERSION = '0.11.2'
VERSION = '0.11.3'

-- This function is called when tg receive a msg
function on_msg_receive (msg)
Expand Down Expand Up @@ -74,7 +74,6 @@ local function is_plugin_disabled_on_chat(plugin_name, receiver)
if disabled_chats and disabled_chats[receiver] then
-- Checks if plugin is disabled on this chat
for disabled_plugin,disabled in pairs(disabled_chats[receiver]) do
print(disabled_plugin)
if disabled_plugin == plugin_name and disabled then
local warning = 'Plugin '..disabled_plugin..' is disabled on this chat'
print(warning)
Expand Down
16 changes: 11 additions & 5 deletions bot/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -212,12 +212,18 @@ function file_exists(name)
end

-- Save into file the data serialized for lua.
function serialize_to_file(data, file)
-- Set uglify true to minify the file.
function serialize_to_file(data, file, uglify)
file = io.open(file, 'w+')
local serialized = serpent.block(data, {
comment = false,
name = "_"
})
local serialized
if not uglify then
serialized = serpent.block(data, {
comment = false,
name = '_'
})
else
serialized = serpent.dump(data)
end
file:write(serialized)
file:close()
end
Expand Down

0 comments on commit 12a56a0

Please sign in to comment.