diff --git a/polymer/eduke32/source/lunatic/bcheck.lua b/polymer/eduke32/source/lunatic/bcheck.lua index f6b80a0cf..2c8007a62 100644 --- a/polymer/eduke32/source/lunatic/bcheck.lua +++ b/polymer/eduke32/source/lunatic/bcheck.lua @@ -98,9 +98,15 @@ function bcheck.top_level(funcname) end end -function bcheck.number(val) - if (type(val)~="number") then - error("invalid argument: must be a number", 3) +function bcheck.number(val, errlev) + if (type(val)~="number" or val~=val) then + error("invalid argument: must be a non-NaN number", errlev or 3) + end +end + +function bcheck.type(val, typestr) + if (type(val)~=typestr) then + error("invalid argument: must be a "..typestr, 3) end end diff --git a/polymer/eduke32/source/lunatic/control.lua b/polymer/eduke32/source/lunatic/control.lua index 3edde16a7..cd58b136a 100644 --- a/polymer/eduke32/source/lunatic/control.lua +++ b/polymer/eduke32/source/lunatic/control.lua @@ -165,6 +165,7 @@ local check_tile_idx = bcheck.tile_idx local check_sprite_idx = bcheck.sprite_idx local check_player_idx = bcheck.player_idx local check_sound_idx = bcheck.sound_idx +local check_type = bcheck.type -- Will contain [