diff options
author | David Walter Seikel | 2012-02-04 22:47:37 +1000 |
---|---|---|
committer | David Walter Seikel | 2012-02-04 22:47:37 +1000 |
commit | 6b097d337444a0e02efc6cebed08a860d2e435ed (patch) | |
tree | b923c45c8f71068d3acc705d813a794a44cff030 /LuaSL/src/LSL.lua | |
parent | Set variables to a proper value if otherwised unitialized. (diff) | |
download | SledjHamr-6b097d337444a0e02efc6cebed08a860d2e435ed.zip SledjHamr-6b097d337444a0e02efc6cebed08a860d2e435ed.tar.gz SledjHamr-6b097d337444a0e02efc6cebed08a860d2e435ed.tar.bz2 SledjHamr-6b097d337444a0e02efc6cebed08a860d2e435ed.tar.xz |
Implement typecasts when needed. Actually, doing some extras for the moment.
Diffstat (limited to '')
-rw-r--r-- | LuaSL/src/LSL.lua | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/LuaSL/src/LSL.lua b/LuaSL/src/LSL.lua index cc9b454..1e7cc13 100644 --- a/LuaSL/src/LSL.lua +++ b/LuaSL/src/LSL.lua | |||
@@ -311,6 +311,38 @@ function LSL.stateChange(x) | |||
311 | end | 311 | end |
312 | end; | 312 | end; |
313 | 313 | ||
314 | function LSL.floatTypecast(x) | ||
315 | local temp = tonumber(x) | ||
316 | if nil == temp then temp = 0 end | ||
317 | return temp; | ||
318 | end | ||
319 | |||
320 | function LSL.integerTypecast(x) | ||
321 | local temp = tonumber(x) | ||
322 | if nil == temp then temp = 0 end | ||
323 | return temp; | ||
324 | end | ||
325 | |||
326 | function LSL.keyTypecast(x) | ||
327 | return "" .. x; | ||
328 | end | ||
329 | |||
330 | function LSL.listTypecast(x) | ||
331 | return {x}; | ||
332 | end | ||
333 | |||
334 | function LSL.rotationTypecast(x) | ||
335 | return x; | ||
336 | end | ||
337 | |||
338 | function LSL.stringTypecast(x) | ||
339 | return "" .. x; | ||
340 | end | ||
341 | |||
342 | function LSL.vectorTypecast(x) | ||
343 | return x; | ||
344 | end | ||
345 | |||
314 | 346 | ||
315 | return LSL; | 347 | return LSL; |
316 | 348 | ||