stringtypesluaintegerti-nspire

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!


Solution

  • 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...