在 lua 中将整数转换为字符串?
Convert integer to string in lua?
我看过很多将字符串转换为整数的答案,但如何将整数转换为字符串?当我尝试 microseconds.toString()
时,出现以下错误:attempt to index upvalue 'microseconds' (a number value)
请注意,这是在 ti-nspire 运行 os 4.5.0.1180
感谢您提供的任何帮助!
来自https://www.lua.org/manual/5.1/manual.html#pdf-tostring
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, use string.format
. If the metatable of e has a "__tostring
"
field, then tostring calls the corresponding value with e as argument,
and uses the result of the call as its result.
tostring
在 NSpire Lua Scripting API Reference Guide...
的第 1 章 第 1 页中提到
我看过很多将字符串转换为整数的答案,但如何将整数转换为字符串?当我尝试 microseconds.toString()
时,出现以下错误:attempt to index upvalue 'microseconds' (a number value)
请注意,这是在 ti-nspire 运行 os 4.5.0.1180
感谢您提供的任何帮助!
来自https://www.lua.org/manual/5.1/manual.html#pdf-tostring
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, use
string.format
. If the metatable of e has a "__tostring
" field, then tostring calls the corresponding value with e as argument, and uses the result of the call as its result.
tostring
在 NSpire Lua Scripting API Reference Guide...