From 894e28d6200ad365b7f3fb9b030b38f1bf8017c0 Mon Sep 17 00:00:00 2001 From: relt-1 <60782515+relt-1@users.noreply.github.com> Date: Thu, 28 Sep 2023 11:02:10 +0200 Subject: [PATCH] Fix the stupid 2 --- __main__.py | 37 +- .../Contributing/API/Structs/QScriptArgs.html | 6 +- .../API/Structs/QScriptCallback.html | 6 +- .../API/Structs/QScriptClass.html | 6 +- .../API/Structs/QScriptClassCreator.html | 6 +- .../API/Structs/QScriptFunction.html | 6 +- .../API/Structs/QScriptObject.html | 6 +- dst/QScript/Contributing/Internals/QArgs.html | 6 +- .../Contributing/Internals/QCallback.html | 6 +- .../Contributing/Internals/QClass.html | 6 +- .../Contributing/Internals/QFunction.html | 6 +- .../Contributing/Internals/QInstance.html | 6 +- .../Contributing/Internals/QInterface.html | 6 +- dst/QScript/Contributing/Internals/QMod.html | 6 +- .../Contributing/Internals/QModule.html | 6 +- .../Contributing/Internals/QObject.html | 6 +- .../Contributing/Rundown/QScriptRundown1.html | 4 +- .../Contributing/Rundown/QScriptRundown2.html | 4 +- .../Contributing/Rundown/QScriptRundown3.html | 4 +- .../Contributing/Rundown/QScriptRundown4.html | 4 +- .../Contributing/Rundown/QScriptRundown5.html | 4 +- .../Contributing/Rundown/QScriptRundown6.html | 446 ++++++++++++++++- dst/QScript/Lua/Classes.html | 4 +- dst/QScript/Lua/Exports.html | 4 +- dst/QScript/Lua/Imports.html | 4 +- dst/QScript/Lua/Objects.html | 4 +- .../Contributing/Rundown/QScriptRundown6.md | 455 ++++++++++++++++++ 27 files changed, 929 insertions(+), 135 deletions(-) diff --git a/__main__.py b/__main__.py index 28a30f7..33a30e6 100644 --- a/__main__.py +++ b/__main__.py @@ -83,32 +83,31 @@ def ConvertStrToHtml(rawmarkdown : str): dollarsnippet = rawmarkdown[i+2:] if dollarsnippet.startswith("SMALL"): dollarname = "SMALL" - #closelist.append("SMALL") - #rawmarkdown = rawmarkdown[:i]+""+rawmarkdown[i+7:] i+=5 elif dollarsnippet.startswith("FRAME"): dollarname = "FRAME" - #closelist.append("FRAME") - #rawmarkdown = rawmarkdown[:i]+"
"+rawmarkdown[i+7:] i+=5 elif dollarsnippet.startswith("INLINEFRAME"): dollarname = "INLINEFRAME" - #closelist.append("INLINEFRAME") - #rawmarkdown = rawmarkdown[:i]+"
"+rawmarkdown[i+13:] i+=11 + elif dollarsnippet.startswith("COMMENT"): + dollarname = "COMMENT" + i+=7 beginningdollar = i+2 indentlevel += 1 i+=2 elif rawmarkdown[i:i+2] == "_$": indentlevel -= 1 if indentlevel == 0 and beginningdollar != -1: - snippet = ConvertStrToHtml(rawmarkdown[beginningdollar:i].strip()).strip() + snippet = "" + if dollarname != "COMMENT": + snippet = ConvertStrToHtml(rawmarkdown[beginningdollar:i].strip()).strip() if dollarname == "SMALL": snippet = ""+snippet.strip().replace("

","").replace("

","")+"
" elif dollarname == "FRAME": - snippet = "
"+snippet+"
" + snippet = "
"+snippet+"
" elif dollarname == "INLINEFRAME": - snippet = "
"+snippet+"
" + snippet = "
"+snippet+"
" rawmarkdown = rawmarkdown[:tocut]+snippet+rawmarkdown[i+2:] beginningdollar = -1 i = tocut+len(snippet)-3 @@ -123,13 +122,23 @@ def ConvertStrToHtml(rawmarkdown : str): else: foundpath = FindFile(link[2:-2]+".md").replace(".md","").replace("\\","/") rawmarkdown = rawmarkdown.replace(link, ""+foundpath.split("/")[-1]+"") - embeds = re.findall(r'\{\{[^\{^\}]+\}\}', rawmarkdown) + embeds = re.findall(r'\{\{[^\{\}]+?\}\}', rawmarkdown,re.MULTILINE) for embed in embeds: - if os.path.exists(os.path.join(src,embed[2:-2]+".embed.md")): - rawmarkdown = rawmarkdown.replace(embed, ConvertToHtml(src+embed[2:-2]+".embed.md")) + path_and_args = embed[2:-2].split("|") + path = path_and_args[0] + if os.path.exists(os.path.join(src,path+".embed.md")): + path = src+path+".embed.md" else: - foundpath = FindFile(embed[2:-2]+".embed.md").replace("\\","/") - rawmarkdown = rawmarkdown.replace(embed, ConvertToHtml(src+foundpath)) + foundpath = FindFile(path+".embed.md").replace("\\","/") + path = src+foundpath + with open(path,"r") as f: + embedcontent = f.read().replace("\r\n","\n").replace("\\}","}") + if len(path_and_args) > 1: + i = 1 + for arg in path_and_args[1:]: + embedcontent = embedcontent.replace("$"+str(i)+"$", arg) + i+=1 + rawmarkdown = rawmarkdown.replace(embed, ConvertStrToHtml(embedcontent)) links = re.findall(r'\[[^\[^\]]+\]\[[^\[^\]]+\]',rawmarkdown) for link in links: name = link[1:].split("]",1)[0] diff --git a/dst/QScript/Contributing/API/Structs/QScriptArgs.html b/dst/QScript/Contributing/API/Structs/QScriptArgs.html index 288aea5..173f4e2 100644 --- a/dst/QScript/Contributing/API/Structs/QScriptArgs.html +++ b/dst/QScript/Contributing/API/Structs/QScriptArgs.html @@ -473,11 +473,7 @@ th, td

QScriptArgs

-

This page is a stub. You should expand it by making a pull request on our GitHub repository

- -

This page is a stub. You should expand it by making a pull request on our GitHub repository

- -

This page is a stub. You should expand it by making a pull request on our GitHub repository

+

This page is a stub. You should expand it by making a pull request on our GitHub repository

QScriptArgs is a handle to a QArgs struct. Is used in QCFunc.

diff --git a/dst/QScript/Contributing/API/Structs/QScriptCallback.html b/dst/QScript/Contributing/API/Structs/QScriptCallback.html index 2d72a71..9cb6056 100644 --- a/dst/QScript/Contributing/API/Structs/QScriptCallback.html +++ b/dst/QScript/Contributing/API/Structs/QScriptCallback.html @@ -473,11 +473,7 @@ th, td

QScriptCallback

-

This page is a stub. You should expand it by making a pull request on our GitHub repository

- -

This page is a stub. You should expand it by making a pull request on our GitHub repository

- -

This page is a stub. You should expand it by making a pull request on our GitHub repository

+

This page is a stub. You should expand it by making a pull request on our GitHub repository

QScriptCallback is used for calling scripting language functions from C++. It is a handle to a QCallback struct.

diff --git a/dst/QScript/Contributing/API/Structs/QScriptClass.html b/dst/QScript/Contributing/API/Structs/QScriptClass.html index 1b0beda..fd3353f 100644 --- a/dst/QScript/Contributing/API/Structs/QScriptClass.html +++ b/dst/QScript/Contributing/API/Structs/QScriptClass.html @@ -473,11 +473,7 @@ th, td

QScriptClass

-

This page is a stub. You should expand it by making a pull request on our GitHub repository

- -

This page is a stub. You should expand it by making a pull request on our GitHub repository

- -

This page is a stub. You should expand it by making a pull request on our GitHub repository

+

This page is a stub. You should expand it by making a pull request on our GitHub repository

QScriptClass is a handle to a QClass struct.

diff --git a/dst/QScript/Contributing/API/Structs/QScriptClassCreator.html b/dst/QScript/Contributing/API/Structs/QScriptClassCreator.html index 6171886..d0a0831 100644 --- a/dst/QScript/Contributing/API/Structs/QScriptClassCreator.html +++ b/dst/QScript/Contributing/API/Structs/QScriptClassCreator.html @@ -473,11 +473,7 @@ th, td

QScriptClassCreator

-

This page is a stub. You should expand it by making a pull request on our GitHub repository

- -

This page is a stub. You should expand it by making a pull request on our GitHub repository

- -

This page is a stub. You should expand it by making a pull request on our GitHub repository

+

This page is a stub. You should expand it by making a pull request on our GitHub repository

QScriptClassCreator is a handle to a QClassCreator struct. It is used for defining QScriptClasses.

diff --git a/dst/QScript/Contributing/API/Structs/QScriptFunction.html b/dst/QScript/Contributing/API/Structs/QScriptFunction.html index 65ab55f..2bba204 100644 --- a/dst/QScript/Contributing/API/Structs/QScriptFunction.html +++ b/dst/QScript/Contributing/API/Structs/QScriptFunction.html @@ -473,11 +473,7 @@ th, td

QScriptFunction

-

This page is a stub. You should expand it by making a pull request on our GitHub repository

- -

This page is a stub. You should expand it by making a pull request on our GitHub repository

- -

This page is a stub. You should expand it by making a pull request on our GitHub repository

+

This page is a stub. You should expand it by making a pull request on our GitHub repository

QScriptFunction is a handle to a QFunction which represents a scripting language function.

diff --git a/dst/QScript/Contributing/API/Structs/QScriptObject.html b/dst/QScript/Contributing/API/Structs/QScriptObject.html index f94154a..d0f2328 100644 --- a/dst/QScript/Contributing/API/Structs/QScriptObject.html +++ b/dst/QScript/Contributing/API/Structs/QScriptObject.html @@ -473,11 +473,7 @@ th, td

QScriptObject

-

This page is a stub. You should expand it by making a pull request on our GitHub repository

- -

This page is a stub. You should expand it by making a pull request on our GitHub repository

- -

This page is a stub. You should expand it by making a pull request on our GitHub repository

+

This page is a stub. You should expand it by making a pull request on our GitHub repository

QScriptObject is a handle to a QObject struct.

diff --git a/dst/QScript/Contributing/Internals/QArgs.html b/dst/QScript/Contributing/Internals/QArgs.html index 6f7e12c..59a7a70 100644 --- a/dst/QScript/Contributing/Internals/QArgs.html +++ b/dst/QScript/Contributing/Internals/QArgs.html @@ -473,10 +473,6 @@ th, td

QArgs

-

This page has NO CONTENT! You should write some by making a pull request on our GitHub repository

- -

This page has NO CONTENT! You should write some by making a pull request on our GitHub repository

- -

This page has NO CONTENT! You should write some by making a pull request on our GitHub repository

+

This page has NO CONTENT! You should write some by making a pull request on our GitHub repository

\ No newline at end of file diff --git a/dst/QScript/Contributing/Internals/QCallback.html b/dst/QScript/Contributing/Internals/QCallback.html index b902659..2009c13 100644 --- a/dst/QScript/Contributing/Internals/QCallback.html +++ b/dst/QScript/Contributing/Internals/QCallback.html @@ -473,10 +473,6 @@ th, td

QCallback

-

This page has NO CONTENT! You should write some by making a pull request on our GitHub repository

- -

This page has NO CONTENT! You should write some by making a pull request on our GitHub repository

- -

This page has NO CONTENT! You should write some by making a pull request on our GitHub repository

+

This page has NO CONTENT! You should write some by making a pull request on our GitHub repository

\ No newline at end of file diff --git a/dst/QScript/Contributing/Internals/QClass.html b/dst/QScript/Contributing/Internals/QClass.html index 761d68f..5ccda4b 100644 --- a/dst/QScript/Contributing/Internals/QClass.html +++ b/dst/QScript/Contributing/Internals/QClass.html @@ -473,10 +473,6 @@ th, td

QClass

-

This page has NO CONTENT! You should write some by making a pull request on our GitHub repository

- -

This page has NO CONTENT! You should write some by making a pull request on our GitHub repository

- -

This page has NO CONTENT! You should write some by making a pull request on our GitHub repository

+

This page has NO CONTENT! You should write some by making a pull request on our GitHub repository

\ No newline at end of file diff --git a/dst/QScript/Contributing/Internals/QFunction.html b/dst/QScript/Contributing/Internals/QFunction.html index ed4be6c..1fdffce 100644 --- a/dst/QScript/Contributing/Internals/QFunction.html +++ b/dst/QScript/Contributing/Internals/QFunction.html @@ -473,10 +473,6 @@ th, td

QFunction

-

This page has NO CONTENT! You should write some by making a pull request on our GitHub repository

- -

This page has NO CONTENT! You should write some by making a pull request on our GitHub repository

- -

This page has NO CONTENT! You should write some by making a pull request on our GitHub repository

+

This page has NO CONTENT! You should write some by making a pull request on our GitHub repository

\ No newline at end of file diff --git a/dst/QScript/Contributing/Internals/QInstance.html b/dst/QScript/Contributing/Internals/QInstance.html index 4dfb5d8..f79f6ad 100644 --- a/dst/QScript/Contributing/Internals/QInstance.html +++ b/dst/QScript/Contributing/Internals/QInstance.html @@ -473,10 +473,6 @@ th, td

QInstance

-

This page has NO CONTENT! You should write some by making a pull request on our GitHub repository

- -

This page has NO CONTENT! You should write some by making a pull request on our GitHub repository

- -

This page has NO CONTENT! You should write some by making a pull request on our GitHub repository

+

This page has NO CONTENT! You should write some by making a pull request on our GitHub repository

\ No newline at end of file diff --git a/dst/QScript/Contributing/Internals/QInterface.html b/dst/QScript/Contributing/Internals/QInterface.html index 18af85e..7a86124 100644 --- a/dst/QScript/Contributing/Internals/QInterface.html +++ b/dst/QScript/Contributing/Internals/QInterface.html @@ -473,10 +473,6 @@ th, td

QInterface

-

This page has NO CONTENT! You should write some by making a pull request on our GitHub repository

- -

This page has NO CONTENT! You should write some by making a pull request on our GitHub repository

- -

This page has NO CONTENT! You should write some by making a pull request on our GitHub repository

+

This page has NO CONTENT! You should write some by making a pull request on our GitHub repository

\ No newline at end of file diff --git a/dst/QScript/Contributing/Internals/QMod.html b/dst/QScript/Contributing/Internals/QMod.html index 76b06b1..977cbcb 100644 --- a/dst/QScript/Contributing/Internals/QMod.html +++ b/dst/QScript/Contributing/Internals/QMod.html @@ -473,10 +473,6 @@ th, td

QMod

-

This page has NO CONTENT! You should write some by making a pull request on our GitHub repository

- -

This page has NO CONTENT! You should write some by making a pull request on our GitHub repository

- -

This page has NO CONTENT! You should write some by making a pull request on our GitHub repository

+

This page has NO CONTENT! You should write some by making a pull request on our GitHub repository

\ No newline at end of file diff --git a/dst/QScript/Contributing/Internals/QModule.html b/dst/QScript/Contributing/Internals/QModule.html index 59f37ab..8fc59a1 100644 --- a/dst/QScript/Contributing/Internals/QModule.html +++ b/dst/QScript/Contributing/Internals/QModule.html @@ -473,10 +473,6 @@ th, td

QModule

-

This page has NO CONTENT! You should write some by making a pull request on our GitHub repository

- -

This page has NO CONTENT! You should write some by making a pull request on our GitHub repository

- -

This page has NO CONTENT! You should write some by making a pull request on our GitHub repository

+

This page has NO CONTENT! You should write some by making a pull request on our GitHub repository

\ No newline at end of file diff --git a/dst/QScript/Contributing/Internals/QObject.html b/dst/QScript/Contributing/Internals/QObject.html index 1ed611f..7ee17a0 100644 --- a/dst/QScript/Contributing/Internals/QObject.html +++ b/dst/QScript/Contributing/Internals/QObject.html @@ -473,10 +473,6 @@ th, td

QObject

-

This page has NO CONTENT! You should write some by making a pull request on our GitHub repository

- -

This page has NO CONTENT! You should write some by making a pull request on our GitHub repository

- -

This page has NO CONTENT! You should write some by making a pull request on our GitHub repository

+

This page has NO CONTENT! You should write some by making a pull request on our GitHub repository

\ No newline at end of file diff --git a/dst/QScript/Contributing/Rundown/QScriptRundown1.html b/dst/QScript/Contributing/Rundown/QScriptRundown1.html index c30a686..8bb9a0b 100644 --- a/dst/QScript/Contributing/Rundown/QScriptRundown1.html +++ b/dst/QScript/Contributing/Rundown/QScriptRundown1.html @@ -490,8 +490,6 @@ th, td
-
- -
+
\ No newline at end of file diff --git a/dst/QScript/Contributing/Rundown/QScriptRundown2.html b/dst/QScript/Contributing/Rundown/QScriptRundown2.html index 5810382..3087e68 100644 --- a/dst/QScript/Contributing/Rundown/QScriptRundown2.html +++ b/dst/QScript/Contributing/Rundown/QScriptRundown2.html @@ -484,8 +484,6 @@ Same thing with changing the class after it has been created. I have added a _fi
-
- -
+
\ No newline at end of file diff --git a/dst/QScript/Contributing/Rundown/QScriptRundown3.html b/dst/QScript/Contributing/Rundown/QScriptRundown3.html index d147535..d3bb666 100644 --- a/dst/QScript/Contributing/Rundown/QScriptRundown3.html +++ b/dst/QScript/Contributing/Rundown/QScriptRundown3.html @@ -589,8 +589,6 @@ We can take advantage of that by first checking if the QFunction - - - + \ No newline at end of file diff --git a/dst/QScript/Contributing/Rundown/QScriptRundown4.html b/dst/QScript/Contributing/Rundown/QScriptRundown4.html index dc2ac68..4b4db0d 100644 --- a/dst/QScript/Contributing/Rundown/QScriptRundown4.html +++ b/dst/QScript/Contributing/Rundown/QScriptRundown4.html @@ -492,8 +492,6 @@ th, td
- - - + \ No newline at end of file diff --git a/dst/QScript/Contributing/Rundown/QScriptRundown5.html b/dst/QScript/Contributing/Rundown/QScriptRundown5.html index 28e2337..7c437c1 100644 --- a/dst/QScript/Contributing/Rundown/QScriptRundown5.html +++ b/dst/QScript/Contributing/Rundown/QScriptRundown5.html @@ -513,8 +513,6 @@ After each module is loaded (at PostInit()), QScript will call - - - + \ No newline at end of file diff --git a/dst/QScript/Contributing/Rundown/QScriptRundown6.html b/dst/QScript/Contributing/Rundown/QScriptRundown6.html index 66c94f3..8628f45 100644 --- a/dst/QScript/Contributing/Rundown/QScriptRundown6.html +++ b/dst/QScript/Contributing/Rundown/QScriptRundown6.html @@ -477,13 +477,11 @@ th, td

I figured that it may be easiest to just go through the function seciton by section.

-

luainterface/luainterface.cpp

- -

+

luainterface/luainterface.cpp

+
lua_State* L = luaL_newstate();
 
-

@@ -492,7 +490,7 @@ th, td
-

luainterface/luainterface.cpp

+

luainterface/luainterface.cpp

QInstance* ins = new QInstance();
@@ -507,7 +505,7 @@ th, td
 
 
-

luainterface/luainterface.cpp

+

luainterface/luainterface.cpp

luaL_openlibs(L);
@@ -518,7 +516,7 @@ th, td
 
 

Which is:

-

lua/linit.c

+

lua/linit.c

static const luaL_Reg loadedlibs[] = {
@@ -541,14 +539,13 @@ th, td
   }
 }
 
-

-

You can notice that it does not include every library, thats because QScript values safety and stability. Some libraries allow for bad things to happen, like unrestricted file access.

+

You can notice that it does not include every library, thats because QScript values safety and stability. Some libraries allow for bad things to happen, like unrestricted file access.

-

luainterface/luainterface.cpp

+

luainterface/luainterface.cpp

luaL_newmetatable(L, "QSCRIPT_OBJECT");
@@ -563,7 +560,7 @@ th, td
 

Here the QSCRIPT_OBJECT metatable starts being defined and here is where things start to get a little wild.
The Lua_QScript_Index function is responsible for getting a value or method from the QObject.

-

luainterface/luainterface.cpp

+

luainterface/luainterface.cpp

int Lua_QScript_Index(lua_State* L)
@@ -608,7 +605,6 @@ The Lua_QScript_Index function is responsible for getting a value or method from
     }
 }
 
-

@@ -651,19 +647,15 @@ It searches first through the values, and then the methods. If any one is found,

You can notice that it can store multiple types, and there is not even a separate variable that says which one it is!
The reason, is that we already have that variable... it's the metatable!

-

We already know if the userdata has a specific metatable, that the pointer stored in the userdata is what we want.

+

We already know if the userdata has a specific metatable, that the pointer stored in the userdata is what we want.


- In fact, here are all the Lua functions that get included. -
-
-
-

luainterface/luainterface.cpp

+

luainterface/luainterface.cpp

int Lua_QScript_New_Index(lua_State* L)
@@ -701,6 +693,422 @@ In fact, here are all the Lua functions that get included.
     }
 }
 
-
+
+ +
+ +

This sets a value in the QObject. It checks if the value accessed actually exists in the object, and if so, sets the objects value to the given one.

+
+

luainterface/luainterface.cpp

+ +
+
int Lua_QScript_Object(lua_State* L)
+{
+    Lua_Userdata* luaclass;
+    if(!(luaclass = (Lua_Userdata*)luaL_checkudata(L,1,"QSCRIPT_CLASS")))
+        return 0;
+    QClass* cls = luaclass->cls;
+    QObject* obj = (QObject*)malloc(sizeof(QObject)+cls->vars_count*sizeof(QValue));
+    obj->cls = cls;
+    g_pQScript->InitializeObject((QScriptObject)obj);
+    ((Lua_Userdata*)lua_newuserdata(L, sizeof(Lua_Userdata)))->obj = obj;
+    luaL_setmetatable(L, "QSCRIPT_OBJECT");
+    return 1;
+}
+
+
+ +
+ +

object() createa a new object from the passed class. It initializes it and returns it to Lua.

+
+

luainterface/luainterface.cpp

+ +
+
int Lua_QScript_Class(lua_State* L)
+{
+    Lua_Userdata* parentluaclass;
+    QClass* cls = 0;
+    if (lua_gettop(L) == 0)
+        return 0; // TODO : error here
+    if (lua_gettop(L) > 0)
+    {
+        if (!(parentluaclass = (Lua_Userdata*)luaL_checkudata(L, 1, "QSCRIPT_CLASS")))
+            return 0; // TODO : error here
+        cls = parentluaclass->cls;
+    }
+    Lua_Userdata* luaclass = (Lua_Userdata*)lua_newuserdata(L, sizeof(Lua_Userdata));
+    luaclass->creator = new QClassCreator();
+    QClassCreator* child = luaclass->creator;
+    child->parent = cls;
+    child->name = 0;
+    luaL_setmetatable(L, "QSCRIPT_CLASS_CREATOR");
+    return 1;
+}
+
+
+ +
+ +

class() creates a new class creator. It takes an optional class as the parent class and returns a new QClassCreator struct.

+
+

luainterface/luainterface.cpp

+ +
+
int Lua_QScript_Class_Creator_NewIndex(lua_State* L)
+{
+    Lua_Userdata* luaclass;
+    if (!(luaclass = (Lua_Userdata*)luaL_checkudata(L, 1, "QSCRIPT_CLASS_CREATOR")))
+        return 0; // TODO : error here
+    QClassCreator* cls = luaclass->creator;
+    if (lua_isfunction(L, 3))
+    {
+        QClassCreatorMethod* meth = (QClassCreatorMethod*)lua_newuserdata(L, sizeof(QClassCreatorMethod));
+        lua_pushvalue(L, 3);
+        QCallback* callback = new QCallback();
+        callback->callback = (void*)luaL_ref(L, LUA_REGISTRYINDEX);
+        callback->lang = current_interface;
+        callback->env = L;
+        callback->object = 0;
+        meth->scripting_func = callback;
+        meth->is_scripting = true;
+        const char* name = lua_tostring(L, 2);
+        meth->name = new char[strlen(name)+1];
+        strcpy(const_cast<char*>(meth->name), name);
+        meth->is_private = false;
+        meth->params = 0;
+        meth->params_count = 0;
+        cls->methods.AddToTail(meth);
+        lua_pop(L, 1);
+        return 0;
+    }
+    else
+    {
+        QVar* var = new QVar();
+        var->is_private = false;
+        const char* name = lua_tostring(L, 2);
+        var->name = new char[strlen(name)+1];
+        strcpy(const_cast<char*>(var->name), name);
+        if (lua_isstring(L, -1))
+        {
+            var->type = QType_String;
+            const char* str = lua_tolstring(L, 3, 0);
+            var->size = 1<<Qlog2(strlen(str));
+            var->defaultval.value_modifiable_string = (char*)malloc(var->size+1);
+            strcpy(var->defaultval.value_modifiable_string, str);
+        }
+        else if (lua_isinteger(L, -1))
+        {
+            var->type = QType_Int;
+            var->defaultval.value_int = lua_tointeger(L, 3);
+        }
+        else if (lua_isnumber(L, -1))
+        {
+            var->type = QType_Float;
+            var->defaultval.value_float = lua_tonumber(L, 3);
+        }
+        else if (lua_isboolean(L, -1))
+        {
+            var->type = QType_Bool;
+            var->defaultval.value_bool = (bool)lua_toboolean(L, 3);
+        }
+        else
+        {
+            var->type = QType_None;
+        }
+        cls->vars.AddToTail(var);
+        return 0;
+    }
+}
+
+
+ +
+ +

Creates a variable or function in the QClassCreator struct.

+
+

luainterface/luainterface.cpp

+ +
+
int Lua_QScript_Finish(lua_State* L)
+{
+    Lua_Userdata* luaclass;
+    if (!(luaclass = (Lua_Userdata*)luaL_checkudata(L, 1, "QSCRIPT_CLASS_CREATOR")))
+        return 0; // TODO : error here
+    QClassCreator* cls = luaclass->creator;
+    luaclass->cls = (QClass*)g_pQScript->FinishClass((QScriptClassCreator)cls);
+    luaL_setmetatable(L, "QSCRIPT_CLASS");
+    return 0;
+}
+
+
+ +
+ +

This page is a stub. You should expand it by making a pull request on our GitHub repository

+ +


+ +

luainterface/luainterface.cpp

+ +
+
int Lua_QScript_Export(lua_State* L)
+{
+    lua_Debug dbg;
+    if (lua_getstack(L, 2, &dbg))
+        return 0; // TODO : error here, function can only be executed in global context
+    QInstance* ins = (QInstance*)lua_touserdata(L,lua_upvalueindex(1));
+    QFunction* func;
+    Lua_Userdata* usr;
+    if (usr = (Lua_Userdata*)luaL_testudata(L, 1, "QSCRIPT_OBJECT"))
+    {
+        lua_pushglobaltable(L);
+        lua_pushnil(L);
+        while (lua_next(L,-2) != 0)
+        { 
+            if (lua_isuserdata(L, -1) && (usr == (Lua_Userdata*)luaL_testudata(L, -1, "QSCRIPT_OBJECT")))
+            {
+                QExport* exp = new QExport();
+                exp->obj = usr->obj;
+                exp->type = QExport_Object;
+                exp->name = lua_tostring(L, -2);
+                ins->exports.AddToTail(exp);
+                lua_pop(L, 3);
+                return 0;
+            }
+            lua_pop(L, 1);
+        }
+        // TODO : error here, must be a global variable
+        return 0;
+    }
+    else if (usr = (Lua_Userdata*)luaL_testudata(L, 1, "QSCRIPT_CLASS"))
+    {
+        lua_pushglobaltable(L);
+        lua_pushnil(L);
+        while (lua_next(L, -2) != 0)
+        {
+            if (lua_isuserdata(L, -1) && (usr == (Lua_Userdata*)luaL_testudata(L, -1, "QSCRIPT_CLASS")))
+            {
+                QExport* exp = new QExport();
+                exp->cls = usr->cls;
+                exp->type = QExport_Class;
+                exp->name = lua_tostring(L, -2);
+                ins->exports.AddToTail(exp);
+                lua_pop(L, 3);
+                return 0;
+            }
+            lua_pop(L, 1);
+        }
+        // TODO : error here, must be a global variable
+        return 0;
+    }
+    else if (lua_isfunction(L,1))
+    {
+        lua_pushglobaltable(L);
+        lua_pushnil(L);
+        while (lua_next(L, -2) != 0)
+        {
+            if (lua_isfunction(L, -1) && lua_rawequal(L, -1, 1))
+            {
+                func = new QFunction();
+                func->always_zero = 0;
+                func->type = QFunction_Scripting;
+                QCallback* callback = new QCallback();
+                lua_pushvalue(L, 1);
+                callback->callback = (void*)luaL_ref(L, LUA_REGISTRYINDEX);
+                callback->env = L;
+                callback->lang = current_interface;
+                callback->object = 0;
+                func->func_scripting = callback;
+                QExport* exp = new QExport();
+                exp->func = func;
+                exp->type = QExport_Function;
+                exp->name = lua_tostring(L, -2);
+                ins->exports.AddToTail(exp);
+                lua_pop(L, 3);
+                return 0;
+            }
+            lua_pop(L, 1);
+        }
+        // TODO : error here, must be a global variable
+        return 0;
+    }
+    // TODO : error here, must be a QObject, QClass or QFunction
+    return 0;
+}
+
+
+ +
+ +

This page is a stub. You should expand it by making a pull request on our GitHub repository

+ +


+ +

luainterface/luainterface.cpp

+ +
+
int Lua_QScript_Import(lua_State* L)
+{
+    lua_Debug dbg;
+    if (lua_getstack(L, 2, &dbg))
+        return 0; // TODO : error here, function can only be executed in global context
+    QMod* mod = (QMod*)lua_touserdata(L, lua_upvalueindex(1));
+    const char* path;
+    if (!(path = luaL_checkstring(L, 1)))
+        return 0; // TODO : error here, string is required
+    if (!IsValidPath(path))
+        return 0; // TODO : error here, nuh uh
+    if (!mod->instances.Defined(path))
+    {
+        mod->instances[path] = 0;
+        g_pQScript->LoadFile(path);
+    }
+    QInstance* inst = mod->instances[path];
+    if (!inst)
+        return 0; // TODO : error here, most likely a import loop or bad path
+    CUtlVector<QExport*>* exports = &mod->instances[path]->exports;
+    Lua_Userdata* ud;
+    lua_createtable(L, 0, exports->Count());
+    for (int i = 0; i < exports->Count(); i++)
+    {
+        QExport* qexport = exports->Element(i);
+        lua_pushstring(L, qexport->name);
+        switch (qexport->type)
+        {
+        case QExport_Object:
+            ud = (Lua_Userdata*)lua_newuserdata(L, sizeof(Lua_Userdata));
+            ud->obj = qexport->obj;
+            luaL_setmetatable(L, "QSCRIPT_OBJECT");
+            break;
+        case QExport_Class:
+            ud = (Lua_Userdata*)lua_newuserdata(L, sizeof(Lua_Userdata));
+            ud->cls = qexport->cls;
+            luaL_setmetatable(L, "QSCRIPT_CLASS");
+            break;
+        case QExport_Function:
+            ud = (Lua_Userdata*)lua_newuserdata(L, sizeof(Lua_Userdata));
+            ud->func = qexport->func;
+            luaL_setmetatable(L, "QSCRIPT_FUNCTION");
+            break;
+        }
+        lua_settable(L, -3);
+    }
+    return 1;
+}
+
+
+ +
+ +

This page is a stub. You should expand it by making a pull request on our GitHub repository

+ +


+ +

luainterface/luainterface.cpp

+ +
+
int Lua_QScript_Function_Call(lua_State* L)
+{
+    Lua_Userdata* usr = (Lua_Userdata*)luaL_checkudata(L,1,"QSCRIPT_FUNCTION");
+    if (!usr)
+        return 0;
+    QFunction* func = usr->func;
+    if (func->always_zero)
+        return 0;
+    QArgs* args;
+    QReturn ret;
+    lua_remove(L, 1);
+    int count = lua_gettop(L);
+    switch (func->type)
+    {
+    case QFunction_Module:
+        return LuaActualCallback(L, func);
+    case QFunction_Native:
+        Warning("Calling QFunction_Native is unsuppported in Lua yet (you can add it if you want at line %i in file luainterface.cpp)\n", __LINE__);
+        return 0;
+    case QFunction_Scripting:
+        args = (QArgs*)malloc(count * sizeof(QArg) + sizeof(QArgs));
+        args->count = count;
+        args->self = 0;
+        for (int i = 0; i < count; i++)
+        {
+            Lua_Userdata* nusr;
+            union QValue val;
+            if (lua_isinteger(L, i + 1))
+            {
+                args->args[i].type = QType_Int;
+                val.value_int = lua_tointeger(L, i + 1);
+            }
+            else if (lua_isnumber(L, i + 1))
+            {
+                args->args[i].type = QType_Float;
+                val.value_float = (float)lua_tonumber(L, i + 1);
+            }
+            else if (lua_isboolean(L, i + 1))
+            {
+                args->args[i].type = QType_Bool;
+                val.value_bool = lua_toboolean(L, i + 1);
+            }
+            else if (lua_isstring(L, i + 1))
+            {
+                args->args[i].type = QType_String;
+                val.value_string = lua_tolstring(L, i + 1, 0);
+            }
+            else if (lua_isfunction(L, i + 1))
+            {
+                args->args[i].type = QType_Function;
+                QCallback* callback = (QCallback*)malloc(sizeof(QCallback));
+                lua_pushvalue(L, i + 1);
+                callback->callback = (void*)luaL_ref(L, LUA_REGISTRYINDEX);
+                callback->lang = current_interface;
+                callback->env = L;
+                QFunction* func = (QFunction*)malloc(sizeof(QFunction));
+                func->always_zero = 0;
+                func->func_scripting = callback;
+                func->type = QFunction_Scripting;
+                val.value_function = (QScriptFunction)func;
+            }
+            else if (nusr = (Lua_Userdata*)luaL_testudata(L, i + 1, "QSCRIPT_OBJECT"))
+            {
+                args->args[i].type = QType_Object;
+                val.value_object = (QScriptObject)nusr->obj;
+            }
+            args->args[i].val = val;
+            continue;
+        }
+        QReturn ret = ((IBaseScriptingInterface*)func->func_scripting->lang)->CallCallback(func->func_scripting, args);
+        switch (ret.type)
+        {
+        case QType_Bool:
+            lua_pushboolean(L, ret.value.value_bool);
+            return 1;
+        case QType_Float:
+            lua_pushnumber(L, ret.value.value_float);
+            return 1;
+        case QType_String:
+            lua_pushstring(L, ret.value.value_string);
+            return 1;
+        case QType_Int:
+            lua_pushinteger(L, ret.value.value_int);
+            return 1;
+        case QType_Object:
+            ((Lua_Userdata*)lua_newuserdata(L, sizeof(Lua_Userdata)))->obj = (QObject*)ret.value.value_object;
+            luaL_setmetatable(L, "QSCRIPT_OBJECT");
+            return 1;
+        default:
+            return 0;
+        }
+    case QFunction_Void:
+        return 0;
+    }
+    return 0;
+}
+
+
+ +
+ +

This page is a stub. You should expand it by making a pull request on our GitHub repository

\ No newline at end of file diff --git a/dst/QScript/Lua/Classes.html b/dst/QScript/Lua/Classes.html index 57890c0..e904efc 100644 --- a/dst/QScript/Lua/Classes.html +++ b/dst/QScript/Lua/Classes.html @@ -525,8 +525,6 @@ th, td
- - - +
\ No newline at end of file diff --git a/dst/QScript/Lua/Exports.html b/dst/QScript/Lua/Exports.html index 43afd31..ebf252c 100644 --- a/dst/QScript/Lua/Exports.html +++ b/dst/QScript/Lua/Exports.html @@ -506,8 +506,6 @@ th, td
- - - +
\ No newline at end of file diff --git a/dst/QScript/Lua/Imports.html b/dst/QScript/Lua/Imports.html index de8cfe8..cca3b80 100644 --- a/dst/QScript/Lua/Imports.html +++ b/dst/QScript/Lua/Imports.html @@ -503,8 +503,6 @@ th, td
- - - +
\ No newline at end of file diff --git a/dst/QScript/Lua/Objects.html b/dst/QScript/Lua/Objects.html index 4a3e714..e15fcc3 100644 --- a/dst/QScript/Lua/Objects.html +++ b/dst/QScript/Lua/Objects.html @@ -494,8 +494,6 @@ th, td
- - - +
\ No newline at end of file diff --git a/src/QScript/Contributing/Rundown/QScriptRundown6.md b/src/QScript/Contributing/Rundown/QScriptRundown6.md index 498af9a..51f8b65 100644 --- a/src/QScript/Contributing/Rundown/QScriptRundown6.md +++ b/src/QScript/Contributing/Rundown/QScriptRundown6.md @@ -224,4 +224,459 @@ int Lua_QScript_New_Index(lua_State* L) } ``` +--- + +This sets a value in the QObject. It checks if the value accessed actually exists in the object, and if so, sets the objects value to the given one. + +_$ +
+$_INLINEFRAME +$_SMALL luainterface/luainterface.cpp _$ + +```cpp +int Lua_QScript_Object(lua_State* L) +{ + Lua_Userdata* luaclass; + if(!(luaclass = (Lua_Userdata*)luaL_checkudata(L,1,"QSCRIPT_CLASS"))) + return 0; + QClass* cls = luaclass->cls; + QObject* obj = (QObject*)malloc(sizeof(QObject)+cls->vars_count*sizeof(QValue)); + obj->cls = cls; + g_pQScript->InitializeObject((QScriptObject)obj); + ((Lua_Userdata*)lua_newuserdata(L, sizeof(Lua_Userdata)))->obj = obj; + luaL_setmetatable(L, "QSCRIPT_OBJECT"); + return 1; +} +``` + +--- + +`object()` createa a new object from the passed class. It initializes it and returns it to Lua. + +_$ +
+$_INLINEFRAME +$_SMALL luainterface/luainterface.cpp _$ + +```cpp +int Lua_QScript_Class(lua_State* L) +{ + Lua_Userdata* parentluaclass; + QClass* cls = 0; + if (lua_gettop(L) == 0) + return 0; // TODO : error here + if (lua_gettop(L) > 0) + { + if (!(parentluaclass = (Lua_Userdata*)luaL_checkudata(L, 1, "QSCRIPT_CLASS"))) + return 0; // TODO : error here + cls = parentluaclass->cls; + } + Lua_Userdata* luaclass = (Lua_Userdata*)lua_newuserdata(L, sizeof(Lua_Userdata)); + luaclass->creator = new QClassCreator(); + QClassCreator* child = luaclass->creator; + child->parent = cls; + child->name = 0; + luaL_setmetatable(L, "QSCRIPT_CLASS_CREATOR"); + return 1; +} +``` + +--- + +`class()` creates a new class creator. It takes an optional class as the parent class and returns a new QClassCreator struct. + +_$ +
+$_INLINEFRAME +$_SMALL luainterface/luainterface.cpp _$ + +```cpp +int Lua_QScript_Class_Creator_NewIndex(lua_State* L) +{ + Lua_Userdata* luaclass; + if (!(luaclass = (Lua_Userdata*)luaL_checkudata(L, 1, "QSCRIPT_CLASS_CREATOR"))) + return 0; // TODO : error here + QClassCreator* cls = luaclass->creator; + if (lua_isfunction(L, 3)) + { + QClassCreatorMethod* meth = (QClassCreatorMethod*)lua_newuserdata(L, sizeof(QClassCreatorMethod)); + lua_pushvalue(L, 3); + QCallback* callback = new QCallback(); + callback->callback = (void*)luaL_ref(L, LUA_REGISTRYINDEX); + callback->lang = current_interface; + callback->env = L; + callback->object = 0; + meth->scripting_func = callback; + meth->is_scripting = true; + const char* name = lua_tostring(L, 2); + meth->name = new char[strlen(name)+1]; + strcpy(const_cast(meth->name), name); + meth->is_private = false; + meth->params = 0; + meth->params_count = 0; + cls->methods.AddToTail(meth); + lua_pop(L, 1); + return 0; + } + else + { + QVar* var = new QVar(); + var->is_private = false; + const char* name = lua_tostring(L, 2); + var->name = new char[strlen(name)+1]; + strcpy(const_cast(var->name), name); + if (lua_isstring(L, -1)) + { + var->type = QType_String; + const char* str = lua_tolstring(L, 3, 0); + var->size = 1<defaultval.value_modifiable_string = (char*)malloc(var->size+1); + strcpy(var->defaultval.value_modifiable_string, str); + } + else if (lua_isinteger(L, -1)) + { + var->type = QType_Int; + var->defaultval.value_int = lua_tointeger(L, 3); + } + else if (lua_isnumber(L, -1)) + { + var->type = QType_Float; + var->defaultval.value_float = lua_tonumber(L, 3); + } + else if (lua_isboolean(L, -1)) + { + var->type = QType_Bool; + var->defaultval.value_bool = (bool)lua_toboolean(L, 3); + } + else + { + var->type = QType_None; + } + cls->vars.AddToTail(var); + return 0; + } +} +``` + +--- + +Creates a variable or function in the `QClassCreator` struct. + +_$ +
+$_INLINEFRAME +$_SMALL luainterface/luainterface.cpp _$ + +```cpp +int Lua_QScript_Finish(lua_State* L) +{ + Lua_Userdata* luaclass; + if (!(luaclass = (Lua_Userdata*)luaL_checkudata(L, 1, "QSCRIPT_CLASS_CREATOR"))) + return 0; // TODO : error here + QClassCreator* cls = luaclass->creator; + luaclass->cls = (QClass*)g_pQScript->FinishClass((QScriptClassCreator)cls); + luaL_setmetatable(L, "QSCRIPT_CLASS"); + return 0; +} +``` + +--- + +{{Stub}} + +_$ +
+$_INLINEFRAME +$_SMALL luainterface/luainterface.cpp _$ + +```cpp +int Lua_QScript_Export(lua_State* L) +{ + lua_Debug dbg; + if (lua_getstack(L, 2, &dbg)) + return 0; // TODO : error here, function can only be executed in global context + QInstance* ins = (QInstance*)lua_touserdata(L,lua_upvalueindex(1)); + QFunction* func; + Lua_Userdata* usr; + if (usr = (Lua_Userdata*)luaL_testudata(L, 1, "QSCRIPT_OBJECT")) + { + lua_pushglobaltable(L); + lua_pushnil(L); + while (lua_next(L,-2) != 0) + { + if (lua_isuserdata(L, -1) && (usr == (Lua_Userdata*)luaL_testudata(L, -1, "QSCRIPT_OBJECT"))) + { + QExport* exp = new QExport(); + exp->obj = usr->obj; + exp->type = QExport_Object; + exp->name = lua_tostring(L, -2); + ins->exports.AddToTail(exp); + lua_pop(L, 3); + return 0; + } + lua_pop(L, 1); + } + // TODO : error here, must be a global variable + return 0; + } + else if (usr = (Lua_Userdata*)luaL_testudata(L, 1, "QSCRIPT_CLASS")) + { + lua_pushglobaltable(L); + lua_pushnil(L); + while (lua_next(L, -2) != 0) + { + if (lua_isuserdata(L, -1) && (usr == (Lua_Userdata*)luaL_testudata(L, -1, "QSCRIPT_CLASS"))) + { + QExport* exp = new QExport(); + exp->cls = usr->cls; + exp->type = QExport_Class; + exp->name = lua_tostring(L, -2); + ins->exports.AddToTail(exp); + lua_pop(L, 3); + return 0; + } + lua_pop(L, 1); + } + // TODO : error here, must be a global variable + return 0; + } + else if (lua_isfunction(L,1)) + { + lua_pushglobaltable(L); + lua_pushnil(L); + while (lua_next(L, -2) != 0) + { + if (lua_isfunction(L, -1) && lua_rawequal(L, -1, 1)) + { + func = new QFunction(); + func->always_zero = 0; + func->type = QFunction_Scripting; + QCallback* callback = new QCallback(); + lua_pushvalue(L, 1); + callback->callback = (void*)luaL_ref(L, LUA_REGISTRYINDEX); + callback->env = L; + callback->lang = current_interface; + callback->object = 0; + func->func_scripting = callback; + QExport* exp = new QExport(); + exp->func = func; + exp->type = QExport_Function; + exp->name = lua_tostring(L, -2); + ins->exports.AddToTail(exp); + lua_pop(L, 3); + return 0; + } + lua_pop(L, 1); + } + // TODO : error here, must be a global variable + return 0; + } + // TODO : error here, must be a QObject, QClass or QFunction + return 0; +} +``` + +--- + +{{Stub}} + +_$ +
+$_INLINEFRAME +$_SMALL luainterface/luainterface.cpp _$ + +```cpp +int Lua_QScript_Import(lua_State* L) +{ + lua_Debug dbg; + if (lua_getstack(L, 2, &dbg)) + return 0; // TODO : error here, function can only be executed in global context + QMod* mod = (QMod*)lua_touserdata(L, lua_upvalueindex(1)); + const char* path; + if (!(path = luaL_checkstring(L, 1))) + return 0; // TODO : error here, string is required + if (!IsValidPath(path)) + return 0; // TODO : error here, nuh uh + if (!mod->instances.Defined(path)) + { + mod->instances[path] = 0; + g_pQScript->LoadFile(path); + } + QInstance* inst = mod->instances[path]; + if (!inst) + return 0; // TODO : error here, most likely a import loop or bad path + CUtlVector* exports = &mod->instances[path]->exports; + Lua_Userdata* ud; + lua_createtable(L, 0, exports->Count()); + for (int i = 0; i < exports->Count(); i++) + { + QExport* qexport = exports->Element(i); + lua_pushstring(L, qexport->name); + switch (qexport->type) + { + case QExport_Object: + ud = (Lua_Userdata*)lua_newuserdata(L, sizeof(Lua_Userdata)); + ud->obj = qexport->obj; + luaL_setmetatable(L, "QSCRIPT_OBJECT"); + break; + case QExport_Class: + ud = (Lua_Userdata*)lua_newuserdata(L, sizeof(Lua_Userdata)); + ud->cls = qexport->cls; + luaL_setmetatable(L, "QSCRIPT_CLASS"); + break; + case QExport_Function: + ud = (Lua_Userdata*)lua_newuserdata(L, sizeof(Lua_Userdata)); + ud->func = qexport->func; + luaL_setmetatable(L, "QSCRIPT_FUNCTION"); + break; + } + lua_settable(L, -3); + } + return 1; +} +``` + +--- + +{{Stub}} + +_$ +
+$_INLINEFRAME +$_SMALL luainterface/luainterface.cpp _$ + +```cpp +int Lua_QScript_Function_Call(lua_State* L) +{ + Lua_Userdata* usr = (Lua_Userdata*)luaL_checkudata(L,1,"QSCRIPT_FUNCTION"); + if (!usr) + return 0; + QFunction* func = usr->func; + if (func->always_zero) + return 0; + QArgs* args; + QReturn ret; + lua_remove(L, 1); + int count = lua_gettop(L); + switch (func->type) + { + case QFunction_Module: + return LuaActualCallback(L, func); + case QFunction_Native: + Warning("Calling QFunction_Native is unsuppported in Lua yet (you can add it if you want at line %i in file luainterface.cpp)\n", __LINE__); + return 0; + case QFunction_Scripting: + args = (QArgs*)malloc(count * sizeof(QArg) + sizeof(QArgs)); + args->count = count; + args->self = 0; + for (int i = 0; i < count; i++) + { + Lua_Userdata* nusr; + union QValue val; + if (lua_isinteger(L, i + 1)) + { + args->args[i].type = QType_Int; + val.value_int = lua_tointeger(L, i + 1); + } + else if (lua_isnumber(L, i + 1)) + { + args->args[i].type = QType_Float; + val.value_float = (float)lua_tonumber(L, i + 1); + } + else if (lua_isboolean(L, i + 1)) + { + args->args[i].type = QType_Bool; + val.value_bool = lua_toboolean(L, i + 1); + } + else if (lua_isstring(L, i + 1)) + { + args->args[i].type = QType_String; + val.value_string = lua_tolstring(L, i + 1, 0); + } + else if (lua_isfunction(L, i + 1)) + { + args->args[i].type = QType_Function; + QCallback* callback = (QCallback*)malloc(sizeof(QCallback)); + lua_pushvalue(L, i + 1); + callback->callback = (void*)luaL_ref(L, LUA_REGISTRYINDEX); + callback->lang = current_interface; + callback->env = L; + QFunction* func = (QFunction*)malloc(sizeof(QFunction)); + func->always_zero = 0; + func->func_scripting = callback; + func->type = QFunction_Scripting; + val.value_function = (QScriptFunction)func; + } + else if (nusr = (Lua_Userdata*)luaL_testudata(L, i + 1, "QSCRIPT_OBJECT")) + { + args->args[i].type = QType_Object; + val.value_object = (QScriptObject)nusr->obj; + } + args->args[i].val = val; + continue; + } + QReturn ret = ((IBaseScriptingInterface*)func->func_scripting->lang)->CallCallback(func->func_scripting, args); + switch (ret.type) + { + case QType_Bool: + lua_pushboolean(L, ret.value.value_bool); + return 1; + case QType_Float: + lua_pushnumber(L, ret.value.value_float); + return 1; + case QType_String: + lua_pushstring(L, ret.value.value_string); + return 1; + case QType_Int: + lua_pushinteger(L, ret.value.value_int); + return 1; + case QType_Object: + ((Lua_Userdata*)lua_newuserdata(L, sizeof(Lua_Userdata)))->obj = (QObject*)ret.value.value_object; + luaL_setmetatable(L, "QSCRIPT_OBJECT"); + return 1; + default: + return 0; + } + case QFunction_Void: + return 0; + } + return 0; +} +``` + +--- + +{{Stub}} + +_$ + + +$_COMMENT + +$_INLINEFRAME +$_SMALL luainterface/luainterface.cpp _$ + +```cpp + +``` + +--- + +{{Stub}} + +_$ + +$_INLINEFRAME +$_SMALL luainterface/luainterface.cpp _$ + +```cpp + +``` + +--- + +{{Stub}} + +_$ + _$ \ No newline at end of file