SL's implementation of Lua now has three number-ish types:
  • number
    (built-in)
  • boolean
    (built-in,
    false
    is distinct from
    0
    )
  • integer
    (userdata, for compatibility with LSL API)
  • integers can be created from numbers by calling
    integer()
Right now, we can't convert
boolean
to
integer
, which makes writing scripts a bit convoluted:
enable = false -- eg. result of `health <= 0`
ll.SetPrimitiveParams({PRIM_PHYSICS, integer(enable)})
-- error: lua_script:2: unable to cast!
-- [C] function integer
The current solution would have to be:
enable = false -- eg. result of `health <= 0`
enable = if enable then 1 else 0
ll.SetPrimitiveParams({PRIM_PHYSICS, integer(enable)})