math.setEvalSettings

From Inspired-Lua Wiki
Jump to: navigation, search

math.setEvalSettings is a math library extension used to override one or more of the current document settings for all subsequent math evaluations performed by math.eval and math.evalStr. It does not change the document context settings.


The function math.setEvalSettings may be called at any point in the script app. The modified document settings are used by math.eval for all subsequent calls within the script app (unless modified by a subsequent call to setEvalSettings ).


Note: All results from the TI-Nspire math server are returned as full-precision expressions. If users want to limit the display digits, they must call math.getEvalSettings() and apply the appropriate precision before displaying the value returned by the TI-Nspire math server.


This has been introduced in TI-Nspire OS 3.2 (Changes).

Syntax[edit]

math.setEvalSettings(settingsTable)

Parameter Type Description
settingsTable
table Table of tables. Each inner table consists of the name of the document setting to override and the name of the value to use instead.

The key-values are either text strings or the number they're linked to.


Example[edit]

settings = {
 	{'Unit System','Eng/US'},
 	{'Calculation Mode','Approximate'},
 	{'Real or Complex Format','Polar'},
 	{'Exponential Format','Engineering'}
}
math.setEvalSettings(settings)

For user convenience, setEvalSettings also accepts the ordinal number of the setting to override and the ordinal number of the value to use instead. The ordinal numbers to use correspond to the order of the settings and their values found at File > Settings > Document Settings.

settings = {
 	{2,3},
 	{4,3},
 	{6,3},
 	{8,2}
}
math.setEvalSettings(settings)

In fact, setEvalSettings accepts any combination of names (strings) and ordinal numbers.


See also[edit]

math.eval