Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- global.add = function(a, ...) {
- var b = { ... }
- var r = a
- if (typeof(a) == 'string') {
- for each (var i, v in ipairs(b)) {
- r = string.add(r, v)
- }
- } else if (typeof(a) == 'number') {
- for each (var i, v in ipairs(b)) {
- r = math.add(r, v)
- }
- } else if (typeof(a) == 'boolean') {
- // boolean + values : returns if at least one element is true
- if (a) { return a }
- for each (var i, v in ipairs(b)) {
- if (v) { return true }
- }
- return a
- } else if (typeof(a) == 'table') {
- r = table.clone(a)
- for each (var i, v in ipairs(b)) {
- table.add(r, v)
- }
- }
- return r
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement