Ciao,
i’ve divided my project in multiple LUA modules but it seems that the editor autocompletion doesn’t work with them.
Standard libraries (go, tilemap, etc) work.
Imported 3rd party libraries (Monarch, Rendercam) work.
My modules (lua modules files in the project) don’t work.
i declare them in the same way as 3rd party libraries
local MA = require “main.match”
local FL = require “ludobits.m.flow”
local MO = require “monarch.monarch”
Hmm, you should get autocomplete for those… Could you try renaming from MO to monarch and try if that makes any difference (unlikely but worth trying).
Declaration in the file where i want to use it (i.e. game.script)
local CO = require "main.constants"
File content (constants.lua)
local M = {}
-- player1, player2, freezed as defined by the following constants
M.ORBS = {hash("red_orb"), hash("blue_orb"), hash("white_orb")}
M.PLAYER1 = 1
M.PLAYER2 = 2
M.FREEZED = 3
return M
i also have modules with functions (don’t work either)
local M = {}
local CO = require "main.constants"
local BO = require "main.board"
local UT = require "main.utils"
-- dumb AI, places an orb in the first empty cell
M.think = function(player, boardValues)
local tile = vmath.vector3()
for x = CO.BOARD_XMIN, CO.BOARD_XMAX do
for y = CO.BOARD_YMIN, CO.BOARD_YMAX do
tile.x = x;
tile.y = y;
local cellPos = BO.getCellIndexInBoard(tile)
local value = boardValues[cellPos]
if(value == nil) then
return tile
end
end
end
return nil
end
return M
This is a limitation of the current Lua parser. We’ve started looking into how it can be improved, but are busy working on other areas of the editor at the moment.