lua-table

    1熱度

    1回答

    我有一個問題, 我必須更改位於n表之前的已知表中的值。 事情是這樣的: Box = { {Name = "",Box = {{Name = "",Box = {{Name = "", Box = {{Name = "This must be change for the test",Box = {}}}}}}}} } 要改變這一點,我可以用硬編碼的: Box[1].Box

    1熱度

    2回答

    我有以下情況,代碼的位置不會改變。如何修改此代碼以修復錯誤而不移動函數和表變量。我是一個Lua新手,只有4天 function a() print("function a"); end ftable = { ["a"] = a, ["b"] = b }; function b() print("function b"); end ftabl

    0熱度

    1回答

    a = {} a[1] = 1 a[2] = nil -- does nothing, as a[2] is already nil a[3] = 14 print(#a) 打印1 a = {} a[1] = 1 a[2] = nil -- does nothing, as a[2] is already nil a[3] = 14 a[4] = 5 print(#a)

    0熱度

    1回答

    我試圖一次迭代多個變量,這些變量存儲在一個很長的數組中。爲了初始化它們,我使用循環遍歷每個變量,將每個變量設置爲0。使用:array[count] = 0它只會改變表索引的值。我該如何在表格中設置這個變量,比如獲取裏面存儲的變量並更改它,而不僅僅是給定索引處的表格值?

    0熱度

    1回答

    所以我想一些東西,我覺得應該是很容易的,但我不能得到它的工作... 基本上我想要做的是: myTable = { a = 1, b = a + 1 } 這是行不通的,我得到「a」爲零的錯誤。合理。 我已經嘗試過是 myTable = { a = 1, b = myTable.a + 1 } 和 myTable = { a = 1,

    1熱度

    1回答

    索引我有LUA表: flys = { ["Moltres"] = {229, 2300}, -- moltres ["Articuno"] = {230, 2100}, -- artic ["Zapdos"] = {224, 2600}, -- zapdos ["Mew"] = {232, 2200}, -- 1000 ["Mewtwo"] = {233, 2200},-- two [

    1熱度

    4回答

    所以我Lua代碼看起來是這樣的: function makeTable() return {1,2,3} end table = { makeTable(), {4,5,6} } 的table結果應該是{{1, 2, 3}, {4, 5, 6}}。 我很在意makeTable()後的逗號。在Lua中,對於返回表的函數,這是否有效?還是有更好的方法讓返回表的

    2熱度

    2回答

    我已經存儲在變量T以下的Lua表: { ["mn"] = { ["index"] = 7, ["key"] = "mn", ["score"] = 0 }, ["kl"] = { ["index"] = 6, ["key"] = "kl", ["score"] = .4 }, ["ef"] = { ["index"] = 3, ["key"] = "ef", ["sc

    0熱度

    1回答

    我有兩個殭屍對象,一個是Grunt,另一個是Runner。 我Grunt.lua文件: function InitGrunt() grunt = {} grunt.x = 0 grunt.y = 0 grunt.speed = 120 grunt.hitBox = (sprites.grunt:getHeight() + sprites.grunt

    0熱度

    1回答

    我希望輸出像(空數組) [] 我嘗試了所有這些低於辦法,但我在得到上面的輸出 未成功 ext_const.cjson_encode(setmetatable(ext_const.cjson_decode("{}"), ext_const.array)) ext_const.cjson_encode(ext_const.cjson_decode("[]")) ext_const.cjson_en