Skip to content

Commit 3c67228

Browse files
att
1 parent 6ec9d1c commit 3c67228

File tree

2 files changed

+42
-39
lines changed

2 files changed

+42
-39
lines changed

luasrc/main.lua

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -71,45 +71,6 @@ private_vibescript.internal_main = function()
7171
return private_vibescript.set_model_as_default()
7272
end
7373

74-
--if it gets here , it will make the normal operation, which is to interpret the first arg
75-
local script_name = action
76-
filename = script_name
77-
local found_filename = false
78-
local scripts = get_prop("scripts", {})
79-
local name_num = tonumber(script_name)
80-
for i = 1 , #scripts do
81-
if scripts[i].name == script_name then
82-
filename = scripts[i].file
83-
found_filename = true
84-
break
85-
end
86-
if name_num == i then
87-
filename = scripts[i].file
88-
found_filename = true
89-
break
90-
end
91-
92-
end
93-
94-
if not found_filename then
95-
filename = dtw.get_absolute_path(script_name)
96-
end
97-
if not filename then
98-
99-
local ok, requisition = pcall(luabear.fetch,{url=script_name})
100-
if ok then
101-
local ok, code = pcall(requisition.read_body)
102-
if ok then
103-
load(code)()
104-
return
105-
end
106-
end
107-
error("File ("..script_name..") does not exist",0)
108-
end
109-
110-
script_dir_name = dtw.newPath(filename).get_dir()
111-
dofile(filename)
112-
11374
end
11475

11576
private_vibescript.main = function()

luasrc/module_load.lua

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
2+
private_vibescript.module_load = function(script_name,load_as_module)
3+
4+
filename = script_name
5+
local found_filename = false
6+
local scripts = get_prop("scripts", {})
7+
local name_num = tonumber(script_name)
8+
for i = 1 , #scripts do
9+
if scripts[i].name == script_name then
10+
filename = scripts[i].file
11+
found_filename = true
12+
break
13+
end
14+
if name_num == i then
15+
filename = scripts[i].file
16+
found_filename = true
17+
break
18+
end
19+
20+
end
21+
22+
if not found_filename then
23+
filename = dtw.get_absolute_path(script_name)
24+
end
25+
if not filename then
26+
27+
local ok, requisition = pcall(luabear.fetch,{url=script_name})
28+
if ok then
29+
local ok, code = pcall(requisition.read_body)
30+
if ok then
31+
load(code)()
32+
return
33+
end
34+
end
35+
error("File ("..script_name..") does not exist",0)
36+
end
37+
38+
script_dir_name = dtw.newPath(filename).get_dir()
39+
is_module = load_as_module or false
40+
dofile(filename)
41+
42+
end

0 commit comments

Comments
 (0)