Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Yonaba/Moses.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Piercy <tap32@medschl.cam.ac.uk>2018-08-13 18:21:16 +0300
committerTom Piercy <tap32@medschl.cam.ac.uk>2018-08-13 18:21:16 +0300
commit0d32ff84682941edca14a5d643c4df27c3e2c75c (patch)
tree683d37eb142e60bf65a4ce4a7dfa82708daa1a67
parent04f98d3c8da4e16c0bd55475d5e73e7ddd4d4aaf (diff)
Test _wrapped value using rawget
Protects against metatables which might return default values for unset keys
-rw-r--r--moses.lua2
1 files changed, 1 insertions, 1 deletions
diff --git a/moses.lua b/moses.lua
index 264fac1..1e4b1b3 100644
--- a/moses.lua
+++ b/moses.lua
@@ -2208,7 +2208,7 @@ do
-- Register all functions into the wrapper
for fname,fct in pairs(_) do
f[fname] = function(v, ...)
- local wrapped = _.isTable(v) and v._wrapped or false
+ local wrapped = _.isTable(v) and rawget(v,'_wrapped') or false
if wrapped then
local _arg = v._value
local _rslt = fct(_arg,...)