Permalink
Browse files

don't return nil after result, when no error message

  • Loading branch information...
1 parent b384c51 commit dad0764a75ff69609a3f7a0b09ff38ea6c9e1fc1 @fperrad committed Mar 7, 2012
Showing with 16 additions and 6 deletions.
  1. +6 −2 CHANGES
  2. +5 −2 src/CodeGen.lua
  3. +5 −2 src/CodeGen/lpeg.lua
View
@@ -1,8 +1,12 @@
Revision history for lua-CodeGen
+0.3.1
+ - don't return nil after result, when no error message
+ (avoid problem with file:write)
+
0.3.0 Sat Mar 3 22:30:00 2012
- work with Lua 5.2.0
- add LuaDist support
+ - work with Lua 5.2.0
+ - add LuaDist support
INCOMPATIBILITY : now, the use of the following idiom is mandatory
local CodeGen = require 'CodeGen'
View
@@ -7,6 +7,7 @@ local setmetatable = setmetatable
local tonumber = tonumber
local tostring = tostring
local type = type
+local unpack = unpack or require'table'.unpack
local char = require 'string'.char
local tconcat = require 'table'.concat
local _G = _G
@@ -210,8 +211,10 @@ local function eval (self, name)
local val = self[name]
if type(val) == 'string' then
- return interpolate(self, val, name),
- (#msg > 0 and tconcat(msg, "\n")) or nil
+ return unpack {
+ interpolate(self, val, name),
+ (#msg > 0 and tconcat(msg, "\n")) or nil,
+ }
else
return render(val)
end
View
@@ -7,6 +7,7 @@ local setmetatable = setmetatable
local tonumber = tonumber
local tostring = tostring
local type = type
+local unpack = unpack or require'table'.unpack
local char = require 'string'.char
local tconcat = require 'table'.concat
local _G = _G
@@ -240,8 +241,10 @@ local function eval (self, name)
local val = self[name]
if type(val) == 'string' then
- return interpolate(self, val, name),
- (#msg > 0 and tconcat(msg, "\n")) or nil
+ return unpack {
+ interpolate(self, val, name),
+ (#msg > 0 and tconcat(msg, "\n")) or nil,
+ }
else
return render(val)
end

0 comments on commit dad0764

Please sign in to comment.