luabridge

    0熱度

    1回答

    每當我運行該程序時,它都不會向控制檯輸出任何內容。 這工作正常,如果我不使用一個類,只是在main()中完成。 當我把它放在課堂上時,我開始有問題。 我在做什麼錯? using namespace luabridge; myClass::myClass() { lua_State* L = luaL_newstate(); luaL_openlibs(L); g

    7熱度

    1回答

    考慮下面的例子: function Process() local Container=NewContainer() Container:On(EventType.Add,function() Container:DoSomething() end) -- Does not Garbage Collect end 在luabridge,我存

    1熱度

    1回答

    我想從一個Lua腳本加載紋理到我的C++遊戲引擎。 引擎使用一個名爲「ResourceHolder」的類,枚舉類型來自一個名爲「ResourceIdenifiers」的類。 我的遊戲場景爲紋理創建了自己的ResourceHolder &字體(以及我需要的任何其他東西)。所以我有用於Textures :: ID(枚舉類型)和字體:: ID的名稱空間。 所以我只需創建一個TextureHolder對象

    3熱度

    1回答

    我有一個觀察者(或「監聽」)圖案在我的代碼實現爲這樣: struct EntityListener { public: virtual void entityModified(Entity& e) = 0; }; class Entity { public: Entity(); void setListener(EntityListener* liste

    2熱度

    2回答

    我想創建一個簡單的類與成員函數,將打印出一些成員的值,但我收到錯誤,當我嘗試引用'自我': attempt to index global 'self' (a nil value) 這裏是我試圖運行腳本: Test = {} function Test:new() T = {} setmetatable(T, self) self.__index = self

    0熱度

    1回答

    我從倉庫試圖編譯LUA橋 https://github.com/vinniefalco/LuaBridge/releases 但是漸漸的錯誤 C2953「luabridge :: FuncTraits」:類模板已被定義LuaBridgeDemo luabridgedemo-1.0 \ luabridgedemo- 1.0 \ luabridge \ luabridge.h 1436 仔細研究後有在

    2熱度

    1回答

    考慮使用LuaBridge對象傳遞到LUA腳本的下面的例子中的對象: ​​ 顯然,傳遞的變量不能由LUA修改: Core.t1.d = 12 print(Core.t1.d) 以上代碼打印10。 同樣在處理腳本後的C++中,變量仍然保持其初始值。 luaL_dofile(lua_state, ".../test.lua"); std::cout << t1.d << std::endl;

    0熱度

    1回答

    我有一個Lua腳本,是應該像一個遊戲組件,如: -- Enemy.lua Enemy = { health = 5, name = "DefaultEnemyName", onUpdate = function() health = health - 1 end, healEnemy = function(amount)

    1熱度

    2回答

    我在1周前用LuaBridge做了第一個小測試,它的工作是從腳本中獲得一個int。 現在我刪除了這段代碼,並嘗試在我的遊戲引擎中包含Lua腳本,但它不再有效。 我想回去跟這個有基本的代碼: #include <iostream> #include "lua5.2/lua.hpp" #include "LuaBridge/LuaBridge.h" using namespace luabr

    1熱度

    1回答

    我想通過基類指針從C++傳遞到Lua使用LuaBridge的對象。派生類和基類都已正確註冊到LuaBridge。 在C++方面: // Assume both Foo and FooBase are registered properly with LuaBridge, // exposing the a, b, and c properties struct FooBase {