打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
LUA 类型转换

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, thentonumber returns this number; otherwise, it returnsnil.

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 e has a "__tostring" field, thentostring calls the corresponding value with e as argument, and uses the result of the call as its result. 

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
和我一起写lua - C和lua的参数传递与返回值
数组及Arrays类
CR Notes by 岛
Openwrt LuCI模块练习详细步骤 1
Function-Call Conversions
Numbers
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服