LUA 类型转换
2013-12-26 13:51
141 查看
tonumber (e [, base])
Tries to convert its argument to a number. If the argument is already a number or a string convertible to a number, thentonumberreturns this number; otherwise, it returns
nil.
An optional argument specifies the base to interpret the numeral. The base may be any integer between 2 and 36, inclusive. In bases above 10, the letter '
A' (in either upper or lower case) represents 10, '
B' represents 11, and so
forth, with '
Z' representing 35. In base 10 (the default), the number may have a decimal part, as well as an optional exponent part (see
§2.1). In other bases, only unsigned integers are accepted.
tostring (e)
Receives an argument of any type and converts it to a string in a reasonable format. For complete control of how numbers are converted, usestring.format.
If the metatable of
ehas a
"__tostring"field, then
tostringcalls the corresponding value with
eas argument, and uses the result of the call as its result.
相关文章推荐
- 【lua笔记】lua数据类型转换
- Lua 数据类型和 Redis 数据类型之间转换
- Lua数据类型转换
- [cocos2dx笔记017]cocos2dx 2.2.6 lua的类型转换
- lua 类型转换
- Lua类型判断和转换的简易方法
- Cocos2d-Lua之类型及类型转换
- 无法将类型“ASP.login_aspx”转换为“System.Web.UI.WebControls.Login”
- 全面了解各种NAT类型及转换原理
- java中如何将Object类型转换为int类型
- ORA-22858: 数据类型的变更无效 varchar2类型转换为clob类型
- 实体类型的转换? Automapper OR 自定义
- 超级简单的string 类型转换成char*类型的方法。
- VC++的类型转换(2)
- C#引用C++ Dll 所有类型转换的方式
- C语言中的数据类型及其转换详解
- 2-Java数据类型及转换细节、运算符
- C#中的类型转换大总结
- VC常用数据类型转换
- FILETIME类型的变量转换为CString