summaryrefslogtreecommitdiff
path: root/src/00-misc
diff options
context:
space:
mode:
Diffstat (limited to 'src/00-misc')
-rw-r--r--src/00-misc/main.cpp37
-rw-r--r--src/00-misc/misc.lua11
-rw-r--r--src/00-misc/vec.lua2
3 files changed, 44 insertions, 6 deletions
diff --git a/src/00-misc/main.cpp b/src/00-misc/main.cpp
index d55dac8..ce137b2 100644
--- a/src/00-misc/main.cpp
+++ b/src/00-misc/main.cpp
@@ -10,8 +10,28 @@ extern "C" {
#include <windows.h>
#include <time.h>
#include <conio.h>
+#include <iostream>
+
+using namespace std;
+
+static int __gc(lua_State* L)
+{
+ return 0;
+}
+
+static int l_createObj(lua_State* L)
+{
+ int* u = (int*)lua_newuserdata(L, sizeof(int));
+ lua_newtable(L);
+ lua_pushstring(L, "__gc");
+ lua_pushcfunction(L, __gc);
+ lua_rawset(L, -3);
+ lua_setmetatable(L, -2);
+ return 1;
+}
luaL_reg fns[] = {
+ {"createObj", l_createObj},
{ 0, 0 }
};
@@ -28,6 +48,23 @@ void openlibs(lua_State* L)
}
}
+class MyClass
+{
+public :
+ virtual void Foo() {};
+
+};
+
+
+class MyClass2 : public MyClass
+{
+public:
+
+ virtual void Foo() {};
+
+};
+
+
int main(int args, char* argv[])
{
lua_State* L = luaL_newstate();
diff --git a/src/00-misc/misc.lua b/src/00-misc/misc.lua
index 8894dbb..e615ff2 100644
--- a/src/00-misc/misc.lua
+++ b/src/00-misc/misc.lua
@@ -1,5 +1,8 @@
-a = "a"
-b = "b"
-c = "c"
-c = nil
+a = createObj()
+if a == nil then
+ print("a is nil")
+end
+a = nil
+
collectgarbage()
+print(1) \ No newline at end of file
diff --git a/src/00-misc/vec.lua b/src/00-misc/vec.lua
index 9d81f40..e69de29 100644
--- a/src/00-misc/vec.lua
+++ b/src/00-misc/vec.lua
@@ -1,2 +0,0 @@
-print("vec.lua")
-