init.lua

changeset 148
9245b1d8a818
parent 96
c2c30f94e619
child 149
de10599d1ed4
equal deleted inserted replaced
147:7ab078186587 148:9245b1d8a818
85 -- Built-in bot starter 85 -- Built-in bot starter
86 if not (... and package.loaded[...] ~= nil) then 86 if not (... and package.loaded[...] ~= nil) then
87 require "verse.client"; 87 require "verse.client";
88 88
89 -- Config loading 89 -- Config loading
90 local chunk, err = loadfile("config.lua"); 90 local config = setmetatable({}, { __index = _G });
91 local chunk, err = loadfile("config.lua", "t", config);
91 if not chunk then 92 if not chunk then
92 print("File or syntax error:", err); 93 print("File or syntax error:", err);
93 return 1; 94 return 1;
94 end 95 end
95 96
96 local config = {};
97 setfenv(chunk, setmetatable(config, {__index = _G}));
98 local ok, err = pcall(chunk); 97 local ok, err = pcall(chunk);
99 if not ok then 98 if not ok then
100 print("Error while processing config:", err); 99 print("Error while processing config:", err);
101 return 1; 100 return 1;
102 end 101 end

mercurial