Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert integer to string in lua?

I've seen lot's of answers to convert strings to integers, but how can I convert integers to strings? When I try microseconds.toString() I get the following error: attempt to index upvalue 'microseconds' (a number value)

Please note that this is on a ti-nspire running os 4.5.0.1180

Thanks for any help you can provide!

like image 275
CtrlAltF2 Avatar asked Nov 08 '22 08:11

CtrlAltF2


1 Answers

From 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 is mentioned in Chapter 1, page 1 of the NSpire Lua Scripting API Reference Guide...

like image 196
Piglet Avatar answered Nov 15 '22 11:11

Piglet