summaryrefslogtreecommitdiffstats
path: root/src/Bindings/BindingsProcessor.lua
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2016-06-05 21:18:52 +0200
committerMattes D <github@xoft.cz>2016-06-05 21:18:52 +0200
commit456ffa5bd608c88f5c9b75297fd505b29d0a02e7 (patch)
treeece066d1c1f8e5ebe4a0da9cf918e06094002188 /src/Bindings/BindingsProcessor.lua
parentMerge pull request #3219 from QUSpilPrgm/master (diff)
parentBindings: Fixed cBoundingBox API. (diff)
downloadcuberite-456ffa5bd608c88f5c9b75297fd505b29d0a02e7.tar
cuberite-456ffa5bd608c88f5c9b75297fd505b29d0a02e7.tar.gz
cuberite-456ffa5bd608c88f5c9b75297fd505b29d0a02e7.tar.bz2
cuberite-456ffa5bd608c88f5c9b75297fd505b29d0a02e7.tar.lz
cuberite-456ffa5bd608c88f5c9b75297fd505b29d0a02e7.tar.xz
cuberite-456ffa5bd608c88f5c9b75297fd505b29d0a02e7.tar.zst
cuberite-456ffa5bd608c88f5c9b75297fd505b29d0a02e7.zip
Diffstat (limited to 'src/Bindings/BindingsProcessor.lua')
-rw-r--r--src/Bindings/BindingsProcessor.lua15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/Bindings/BindingsProcessor.lua b/src/Bindings/BindingsProcessor.lua
index a398f5026..e7b909ded 100644
--- a/src/Bindings/BindingsProcessor.lua
+++ b/src/Bindings/BindingsProcessor.lua
@@ -85,6 +85,7 @@ local function OutputLuaStateHelpers(a_Package)
f:write("\n\n\n\n\n")
for _, item in ipairs(types) do
f:write("typedef " .. item.name .. " * Ptr" .. item.lname .. ";\n")
+ f:write("typedef const " .. item.name .. " * ConstPtr" .. item.lname .. ";\n")
end
f:write("\n\n\n\n\n")
f:close()
@@ -104,6 +105,7 @@ local function OutputLuaStateHelpers(a_Package)
end
for _, item in ipairs(types) do
f:write("bool GetStackValue(int a_StackPos, Ptr" .. item.lname .. " & a_ReturnedVal);\n")
+ f:write("bool GetStackValue(int a_StackPos, ConstPtr" .. item.lname .. " & a_ReturnedVal);\n")
end
f:write("\n\n\n\n\n")
f:close()
@@ -139,6 +141,19 @@ local function OutputLuaStateHelpers(a_Package)
f:write("\t}\n")
f:write("\treturn false;\n")
f:write("}\n\n\n\n\n\n")
+
+ f:write("bool cLuaState::GetStackValue(int a_StackPos, ConstPtr" .. item.lname .. " & a_ReturnedVal)\n{\n\tASSERT(IsValid());\n")
+ f:write("\tif (lua_isnil(m_LuaState, a_StackPos))\n\t{\n")
+ f:write("\t\ta_ReturnedVal = nullptr;\n")
+ f:write("\t\treturn false;\n\t}\n")
+ f:write("\ttolua_Error err;\n")
+ f:write("\tif (tolua_isusertype(m_LuaState, a_StackPos, \"const " .. item.name .. "\", false, &err))\n")
+ f:write("\t{\n")
+ f:write("\t\ta_ReturnedVal = *(reinterpret_cast<const " .. item.name .. " **>(lua_touserdata(m_LuaState, a_StackPos)));\n")
+ f:write("\t\treturn true;\n");
+ f:write("\t}\n")
+ f:write("\treturn false;\n")
+ f:write("}\n\n\n\n\n\n")
end
f:close()
end