Skip to content
ryobg edited this page Feb 15, 2018 · 7 revisions

Default values

First and foremost, the game will not crash no matter what data you pass into JContainer functions. The following happens if a function gets called with invalid input (when input cannot be handled properly):

  • All functions returning new containers return zero identifier. For example JValue.readFromFile("") returns 0 because of an invalid file path. Zero identifier means non-existing object. It is ok to pass it into other functions - in that case the function will return also a default value.
  • All functions that read container contents (such as getFlt, solveFlt, getStr, count, allKeys, getObj, solveObj and etc.) will return a default value. For function that return an integer or float, the default value is 0, for functions that return a string the default value is "", for functions that return a form the default value is None, and for functions that return a container the default value is 0.

Number conversion notes

Functions that handle numbers (getFlt, solveFlt, getInt, solveInt) will convert the numbers they handle into their respective types. For example, getFlt will return a float 1.0 if the number passed to it is the int 1. On the other hand, the rest of the get* and solve* functions may fail to perform conversions and will return default values.