aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/lib
diff options
context:
space:
mode:
authorDavid Walter Seikel2014-05-16 07:06:22 +1000
committerDavid Walter Seikel2014-05-16 07:06:22 +1000
commit36e9035a3dfeda6f9ca4030bc04dcb13adf5595c (patch)
treed646f1ccd77048445add193ce6ea3b4f519772fd /lib
parentTypo--, fixes llListInsertList. (diff)
downloadSledjHamr-36e9035a3dfeda6f9ca4030bc04dcb13adf5595c.zip
SledjHamr-36e9035a3dfeda6f9ca4030bc04dcb13adf5595c.tar.gz
SledjHamr-36e9035a3dfeda6f9ca4030bc04dcb13adf5595c.tar.bz2
SledjHamr-36e9035a3dfeda6f9ca4030bc04dcb13adf5595c.tar.xz
Optimize toBool() a little.
Diffstat (limited to 'lib')
-rw-r--r--lib/LSL.lua8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/LSL.lua b/lib/LSL.lua
index 1afc8ec..4ec64b5 100644
--- a/lib/LSL.lua
+++ b/lib/LSL.lua
@@ -1031,10 +1031,10 @@ end
1031 1031
1032-- Lua really hates 0, it's not false, and it can't be a table index. 1032-- Lua really hates 0, it's not false, and it can't be a table index.
1033function LSL.toBool(x) 1033function LSL.toBool(x)
1034 local v = x 1034 local t = type(x)
1035 local t = type(v) 1035
1036 if 'boolean' == t then return v end 1036 if 'boolean' == t then return x end
1037 if 'number' == t then return (v ~= 0) end 1037 if 'number' == t then return (x ~= 0) end
1038 if 'nil' == t then return false end 1038 if 'nil' == t then return false end
1039 -- Is an empty string, empty list, zero vector/rotation false? Fucked if I know. 1039 -- Is an empty string, empty list, zero vector/rotation false? Fucked if I know.
1040 return true 1040 return true