-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
33 lines (29 loc) · 1010 Bytes
/
Program.cs
File metadata and controls
33 lines (29 loc) · 1010 Bytes
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
using LuauSharp.HighLevel;
namespace LuauSharp
{
class Program
{
static unsafe void RunLowLevelExample()
{
Console.WriteLine("--- LuauSharp LowLevel ---");
LuauNative.lua_State* luaState = Luau.New();
bool result = Luau.EnableCodegen(luaState);
ExampleUserdataLowLevel.Register(luaState);
LuauNative.lua_CompileOptions options = new LuauNative.lua_CompileOptions(2, 0, 1);
Luau.DoFile(luaState, "script", "example.luau", result, options);
Luau.Close(luaState);
}
static unsafe void RunHighLevelExample()
{
Console.WriteLine("\n-- LuauSharp HighLevel --");
using LuauVM vm = new();
vm.userdata.RegisterType<ExampleUserdataHighLevel>();
vm.DoFile("exampleHighLevel.luau");
}
static void Main()
{
RunLowLevelExample();
RunHighLevelExample();
}
}
}