mirror of
https://github.com/Michatec/ptelevision.git
synced 2026-03-31 23:46:30 +02:00
Moved all files to root.
This commit is contained in:
25
shared/main.lua
Normal file
25
shared/main.lua
Normal file
@@ -0,0 +1,25 @@
|
||||
Televisions = {}
|
||||
|
||||
function v3(coord)
|
||||
return vector3(coord.x, coord.y, coord.z), coord.w
|
||||
end
|
||||
|
||||
function DumpArray(obj, seen)
|
||||
if type(obj) ~= 'table' then return obj end
|
||||
if seen and seen[obj] then return seen[obj] end
|
||||
local s = seen or {}
|
||||
local res = setmetatable({}, getmetatable(obj))
|
||||
s[obj] = res
|
||||
for k, v in pairs(obj) do res[DumpArray(k, s)] = DumpArray(v, s) end
|
||||
return res
|
||||
end
|
||||
|
||||
function GetTelevision(coords)
|
||||
for k,v in pairs(Televisions) do
|
||||
if #(v3(v.coords) - v3(coords)) < 0.01 then
|
||||
return k, v
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Channels = DumpArray(Config.Channels)
|
||||
Reference in New Issue
Block a user