-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample.lua
57 lines (28 loc) · 1.18 KB
/
example.lua
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
--require struct.lua for inheritance and more object like behavior
struct = require("Modules.Struct")
--require LCLI.lua for the cli object/class
cli = require("LCLI")
--Set constructor for the cli object/class
cli.new = struct.new()
--Use cli:new() to return a new cli object
--Remember to tag the new object with "---@class cli" to get lsp functionality
---@class cli
MainInterface = cli:new()
--cli:Init(name) initalizes some values and sets the name of the cli
MainInterface:Init("Main Interface")
--cli:LoadCliFromFile(filepath) loads a .CLI file into the cli object
MainInterface:LoadCliFromFile("example.CLI")
--cli:Display() displays all the options in the interface
MainInterface:Display()
--cli:GetInput() gets input from io.read() and executes code
-- based on what option you chose
MainInterface:GetInput()
--cli:Append(num, string) appends the array of options displayed with
-- cli:Display()
MainInterface:Append(3, "This is appended")
--cli:SetFunc(num, func) sets the function related to the num displated with
-- cli:Display()
function sayhi()
print("hi from SetFunc()")
end
MainInterface:SetFunc(3, sayhi)