-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathutils.lua
32 lines (29 loc) · 898 Bytes
/
utils.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
-- function used for both
local function set_funcs(mainobject, subobject)
-- this function assigns functions of a subobject to a primary object
--[[
mainobject: the table to which to assign the functions
subobject: the table whose functions to assign
no output
--]]
for k, v in pairs(subobject.__index) do
if k ~= '__gc' and k ~= '__eq' and k ~= '__index'
and k ~= '__tostring' and k ~= 'destroy' and k ~= 'type'
and k ~= 'typeOf'and k ~= 'getUserData' and k ~= 'setUserData' then
mainobject[k] = function(mainobject, ...)
return v(subobject, ...)
end
end
end
end
local COLLIDER_TYPES = {
CIRCLE = "Circle",
CIRC = "Circle",
RECTANGLE = "Rectangle",
RECT = "Rectangle",
POLYGON = "Polygon",
POLY = "Polygon",
EDGE = 'Edge',
CHAIN = 'Chain'
}
return {set_funcs, love.physics, love.graphics, COLLIDER_TYPES}