4.0 - md5 in Lua

4.0 - md5 in Lua

After creating a lua sample project with cocos 4.0
i’m unable to use the external md5 library (ext_md5)

If i try and require “md5” in MyApp.lua
i get the following error:

[LUA-print] [string "app/MyApp.lua"]:4: module 'md5' not found:**
no field package.preload['md5']

And if i try to use the functions directly


I get the following error:

[string "app/MyApp.lua"]:6: attempt to index global 'md5' (a nil value)

I also tried adding the external library in the lua_extensions.c file, i was able to include it like this

#include "md5/md5.h"

but i was not able to figure out what should be added in the luax_exts[]

static luaL_Reg luax_exts[] = {
    {"socket.core", luaopen_socket_core},
    {"mime.core", luaopen_mime_core},
    {NULL, NULL}

It would be great if someone can guide me through this