-
Notifications
You must be signed in to change notification settings - Fork 1
/
Main.cpp
executable file
·64 lines (59 loc) · 1.53 KB
/
Main.cpp
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
//--------------------------------------------------------------------
#include "SoLua.h"
#include "SoLuaBind.h"
#include "LuaBind_MyFunc.h"
//--------------------------------------------------------------------
void main()
{
SoLua::InitLua();
SoLuaBind::InitLuaBind(SoLua::GetLua());
//
SoLuaBind::ExecuteBind(luaRegisterMyFunc);
SoLua::DumpStack();
//
SoLua::ExecuteFile("add.lua");
SoLua::DumpStack();
int nExeResult = 0;
SoLua::CallBegin();
SoLua::PushFunc("add");
SoLua::CallEnd();
SoLua::DumpStack();
//
SoLua::FieldBegin();
SoLua::Push("globalString");
SoLua::FieldEnd();
const char* szglobalString = SoLua::GetString(0, "");
//
SoLua::FieldBegin();
SoLua::PushTable("kkjjf");
SoLua::Push("localStringKey");
SoLua::FieldEnd();
const char* szlocalString = SoLua::GetString(0, "");
//
SoLua::ExecuteChunk("print(\"oil\")", 0);
SoLua::DumpStack();
short ddd = 2;
SoLua::CallBegin();
SoLua::PushTable("adddd");
SoLua::PushTable("ccc");
SoLua::PushFunc("add2");
SoLua::Push(2.5f);
SoLua::Push(4.7);
SoLua::Push("oil");
SoLua::Push(ddd);
SoLua::CallEnd();
double dfReturn = SoLua::GetDouble(0, 0);
const char* szReturn = SoLua::GetString(1, "");
SoLua::FieldBegin();
SoLua::PushTable("adddd");
SoLua::PushTable("ccc");
SoLua::Push("kk");
SoLua::Push("kk33");
SoLua::FieldEnd();
SoLua::DumpStack();
szReturn = SoLua::GetString(0, "");
dfReturn = SoLua::GetDouble(1, 0);
SoLua::DumpStack();
SoLuaBind::ReleaseLuaBind();
SoLua::ReleaseLua();
}