summaryrefslogtreecommitdiffhomepage
path: root/mrbgems/mruby-string-utf8/src/string.c
diff options
context:
space:
mode:
Diffstat (limited to 'mrbgems/mruby-string-utf8/src/string.c')
-rw-r--r--mrbgems/mruby-string-utf8/src/string.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/mrbgems/mruby-string-utf8/src/string.c b/mrbgems/mruby-string-utf8/src/string.c
index b232df1c5..ef9457195 100644
--- a/mrbgems/mruby-string-utf8/src/string.c
+++ b/mrbgems/mruby-string-utf8/src/string.c
@@ -3,6 +3,7 @@
#include "mruby/class.h"
#include "mruby/string.h"
#include "mruby/range.h"
+#include "mruby/numeric.h"
#include "mruby/re.h"
#include <ctype.h>
#include <string.h>
@@ -257,6 +258,8 @@ mrb_str_aref(mrb_state *mrb, mrb_value str, mrb_value indx)
mrb_regexp_check(mrb, indx);
switch (mrb_type(indx)) {
+ case MRB_TT_FLOAT:
+ indx = mrb_flo_to_fixnum(mrb, indx);
case MRB_TT_FIXNUM:
idx = mrb_fixnum(indx);