-
Notifications
You must be signed in to change notification settings - Fork 11
/
roblox.go
101 lines (95 loc) · 2.12 KB
/
roblox.go
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
package library
import (
lua "github.com/anaminus/gopher-lua"
"github.com/anaminus/rbxmk"
"github.com/anaminus/rbxmk/dump"
"github.com/anaminus/rbxmk/dump/dt"
"github.com/anaminus/rbxmk/reflect"
"github.com/anaminus/rbxmk/rtypes"
)
func init() { register(Roblox) }
var Roblox = rbxmk.Library{
Name: "roblox",
Priority: 2,
Open: openRoblox,
Dump: dumpRoblox,
Types: []func() rbxmk.Reflector{
reflect.Array,
reflect.Axes,
reflect.BinaryString,
reflect.Bool,
reflect.BrickColor,
reflect.CFrame,
reflect.Color3,
reflect.Color3uint8,
reflect.ColorSequence,
reflect.ColorSequenceKeypoint,
reflect.Content,
reflect.Dictionary,
reflect.Double,
reflect.Enum,
reflect.EnumItem,
reflect.Enums,
reflect.Faces,
reflect.Float,
reflect.Font,
reflect.Instance,
reflect.Int,
reflect.Int64,
reflect.Number,
reflect.NumberRange,
reflect.NumberSequence,
reflect.NumberSequenceKeypoint,
reflect.Objects,
reflect.PhysicalProperties,
reflect.ProtectedString,
reflect.Ray,
reflect.Rect,
reflect.Region3,
reflect.Region3int16,
reflect.SharedString,
reflect.String,
reflect.Token,
reflect.Tuple,
reflect.UDim,
reflect.UDim2,
reflect.UniqueId,
reflect.Variant,
reflect.Vector2,
reflect.Vector2int16,
reflect.Vector3,
reflect.Vector3int16,
},
}
func openRoblox(s rbxmk.State) *lua.LTable {
lib := s.L.CreateTable(0, 1)
lib.RawSetString("typeof", s.WrapFunc(robloxTypeof))
return lib
}
func robloxTypeof(s rbxmk.State) int {
v := s.CheckAny(1)
t := s.World.Typeof(v)
s.L.Push(lua.LString(t))
return 1
}
func dumpRoblox(s rbxmk.State) dump.Library {
lib := dump.Library{
Struct: dump.Struct{
Fields: dump.Fields{
"typeof": dump.Function{
Parameters: dump.Parameters{
{Name: "value", Type: dt.Prim(rtypes.T_Any)},
},
Returns: dump.Parameters{
{Type: dt.Prim(rtypes.T_LuaString)},
},
Summary: "Libraries/roblox:Fields/typeof/Summary",
Description: "Libraries/roblox:Fields/typeof/Description",
},
},
Summary: "Libraries/roblox:Summary",
Description: "Libraries/roblox:Description",
},
}
return lib
}