- Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathinit.lua
More file actions
Latest commit
66 lines (58 loc) · 1.27 KB
/
Copy pathinit.lua
File metadata and controls
66 lines (58 loc) · 1.27 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
localmodule_path=...
module_path=module_path:match("^(.-)init$") or (module_path..'.')
localffi_enabled, ffi=pcall(require, 'ffi')
localutf8= {
config= {},
default= {
debug=nil,
logger=io.write,
loadstring= (loadstringorload),
unpack= (unpackortable.unpack),
cache=setmetatable({},{
__mode='kv'
}),
locale=nil,
int32array=function(size)
ifffi_enabledthen
returnffi.new("uint32_t[?]", size+1)
else
return {}
end
end,
conversion= {
uc_lc=nil,
lc_uc=nil
}
},
regex= {
compiletime= {
charclass= {},
begins= {},
ends= {},
modifier= {},
}
},
util= {},
}
functionutf8:require(name)
localfull_module_path=module_path..name
ifpackage.loaded[full_module_path] then
returnpackage.loaded[full_module_path]
end
localmod=require(full_module_path)
iftype(mod) =='function' then
mod=mod(self)
package.loaded[full_module_path] =mod
end
returnmod
end
functionutf8:init()
fork, vinpairs(self.default) do
self.config[k] =self.config[k] orv
end
self:require"util"
self:require"primitives.init"
self:require"functions.lua53"
returnself
end
returnutf8