6

我已经看到很多将字符串转换为整数的答案,但是如何将整数转换为字符串?当我尝试时microseconds.toString(),出现以下错误:attempt to index upvalue 'microseconds' (a number value)

请注意,这是在运行 os 4.5.0.1180 的 ti-nspire 上

感谢您的任何帮助,您可以提供!

4

1 回答 1

1

来自https://www.lua.org/manual/5.1/manual.html#pdf-tostring

字符串 (e)

接收任何类型的参数并将其转换为合理格式的字符串。要完全控制数字的转换方式,请使用string.format. 如果 e 的元表有一个 " __tostring" 字段,则 tostring 以 e 作为参数调用相应的值,并将调用的结果作为其结果。

tostringNSpire Lua 脚本 API 参考指南的第 1章第 1中提到...

于 2018-04-23T07:07:43.300 回答