ToLua在lua中使用System.String
function Test()
    local str = System.String.New('男儿当自强A')
    local index = str:IndexOfAny('儿自') 
    print('and index is: '..index) --1
    local buffer = str:ToCharArray()
    print('str type is: '..type(str)..' buffer[5] is ' .. buffer[5])  --65
    local luastr = tolua.tolstring(buffer)
    print('lua string is: '..luastr..' type is: '..type(luastr)) --string
    luastr = tolua.tolstring(str)
    print('lua string is: '..luastr)  --男儿当自强A              
end

首页 我的博客
粤ICP备17103704号