Cannot add dependencies

hello,
When I trying to add lockbox from the link https://github.com/somesocks/lua-lockbox/archive/master.zip to game.projects/dependences then I saw the error below.


Did you know why or how to solve it?
another way, when I downloaded it into a folder then use it like below

local String = require("string");
local Array = require("lockbox.util.array");
local Stream = require("lockbox.util.stream");
local ECBMode = require("lockbox.cipher.mode.ecb");
local CBCMode = require("lockbox.cipher.mode.cbc");
local CFBMode = require("lockbox.cipher.mode.cfb");
local OFBMode = require("lockbox.cipher.mode.ofb");
local CTRMode = require("lockbox.cipher.mode.ctr");
local IGEMode = require("lockbox.cipher.mode.ige");
local PKCS7Padding = require("lockbox.padding.pkcs7");
local ZeroPadding = require("lockbox.padding.zero");
local AES128Cipher = require("lockbox.cipher.aes128");
local M = {}

and what i see that it works well on win32, but when running html5 or android, i got the error
image

If you meet it before or know how to solve it. please let me know

many thanks

If you want to connect project as a dependency, an archive should have game.project file with a path to the library folder. ( read manual here)

Yes, this is a good workaround, but you should cut “lua-lockbox/lockbox” folder and put to the root directory of your project.

1 Like

thanks for your reply
I am already cut lockbox and put in the root( image below). and I can run it normally on win32 and build successfully on html5 and Android, but when running html5/android build, it shows the error

module lockbox.util.array not found

more info:


my code:

Lockbox = require("lockbox.init")
Lockbox.ALLOW_INSECURE = true
local String = require("string");
local Array = require("lockbox.util.array");
local Stream = require("lockbox.util.stream");
local ECBMode = require("lockbox.cipher.mode.ecb");
local CBCMode = require("lockbox.cipher.mode.cbc");
local CFBMode = require("lockbox.cipher.mode.cfb");
local OFBMode = require("lockbox.cipher.mode.ofb");
local CTRMode = require("lockbox.cipher.mode.ctr");
local IGEMode = require("lockbox.cipher.mode.ige");
local PKCS7Padding = require("lockbox.padding.pkcs7");
local ZeroPadding = require("lockbox.padding.zero");
local AES128Cipher = require("lockbox.cipher.aes128");
local M = {}
M.encrypt = function()
	local cipher = ECBMode.Cipher()
	.setKey( Array.fromHex("2b7e151628aed2a6abf7158809cf4f3c"))
	.setBlockCipher(AES128Cipher)
	.setPadding(ZeroPadding);
	local cipherOutput = cipher
	.init()
	.update(Stream.fromArray( Array.fromHex("")))
	.update(Stream.fromArray(Array.fromHex("6bc1bee22e409f96e93d7e117393172a")))
	.finish()
	.asHex();
	print(cipherOutput)
	return cipherOutput
end
return M

could you help to take a look into it?

Where is your code in the project? How do you use your module? (module with the code below)

Defold doesn’t include into the bundle the files that never use (have no links). For *.lua files, it should be required somewhere in the project.

Looks like you loads your module using loadstring() or loadfile() and never require this module, it wouldn’t include into the bundle.

You have two ways here:

  1. write require "path.to.your.module" somewhere
  2. connect folder with your script as Custom Resource

I managed that bug :blush:
that bug happens when in the source code has “;” symbol at end of a line(maybe devs wrote lockbox lib is a c++ developer :smiley: )
‘;’ symbol makes Defold can not compile *.Lua file to *.luac
I just removed that symbol and it works
thanks

1 Like

I assumed too complex things =)

Looks like your bug Lua module not included in bundle · Issue #1692 · defold/editor2-issues · GitHub

1 Like