github.com/hirochachacha/plua@v0.0.0-20170217012138-c82f520cc725/stdlib/utf8/testdata/codes.lua (about) 1 f, t, k = utf8.codes("あい") 2 3 k, v = f(t, k) 4 assert(k == 1 and v == 12354) 5 6 k, v = f(t, k) 7 assert(k == 4 and v == 12356) 8 9 assert(f(t, k) == nil) 10 11 assert(not pcall(f, "\xff", 0)) 12 assert(not pcall(f, "a\xff", 1))