diff options
Diffstat (limited to 'compat53/module.lua')
| -rw-r--r-- | compat53/module.lua | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/compat53/module.lua b/compat53/module.lua index 56c9932..4450bd5 100644 --- a/compat53/module.lua +++ b/compat53/module.lua | |||
| @@ -147,6 +147,20 @@ if lua_version < "5.3" then | |||
| 147 | end | 147 | end |
| 148 | 148 | ||
| 149 | 149 | ||
| 150 | -- assert should allow non-string error objects | ||
| 151 | do | ||
| 152 | function M.assert(cond, ...) | ||
| 153 | if cond then | ||
| 154 | return cond, ... | ||
| 155 | elseif select('#', ...) > 0 then | ||
| 156 | error((...), 0) | ||
| 157 | else | ||
| 158 | error("assertion failed!", 0) | ||
| 159 | end | ||
| 160 | end | ||
| 161 | end | ||
| 162 | |||
| 163 | |||
| 150 | -- ipairs should respect __index metamethod | 164 | -- ipairs should respect __index metamethod |
| 151 | do | 165 | do |
| 152 | local function ipairs_iterator(st, var) | 166 | local function ipairs_iterator(st, var) |
