Fixed Server using commands Bug

This commit is contained in:
Cooldude2606 committed 2019-03-16 18:11:37 +00:00
1 parent cfaa80d153
commit 89b9d8e164
5 files changed
+23 -13

No files matched your search

+6 -4
View File
@@ -56,10 +56,12 @@ Commands.new_command('interface','Sends an innovation to be ran and returns the
end
-- temp_env will index to interface_env and interface_modules if value not found
local temp_env = setmetatable({},{__index=get_index})
for name,callback in pairs(interface_callbacks) do
-- loops over callbacks and loads the values returned
local success, rtn = pcall(callback,player)
temp_env[name]=rtn
if player then -- player can be nil when it is the server
for name,callback in pairs(interface_callbacks) do
-- loops over callbacks and loads the values returned
local success, rtn = pcall(callback,player)
temp_env[name]=rtn
end
end
-- sets the global metatable to prevent new values being made
-- global will index to temp_env and new indexs saved to interface_sandbox