AndroLua icon indicating copy to clipboard operation
AndroLua copied to clipboard

json.lua : attempt to call a nil value (global 'module')

Open xingchch opened this issue 10 years ago • 0 comments

Compile json.lua with luac from lua-5.3.1 , run the binary code but got the error :attempt to call a nil value (global 'module')

if we want to run binary code compiled with luac in lua-5.3.1 ,below way to build module will cause runtime error:

local base = _G

-- Module declaration

module("json")

the right way might be like this:

local moduleName = json local M = {} -- 局部的变量 _G[moduleName] = M -- 将这个局部变量最终赋值给模块名 package.loaded[moduleName] = M ..........

@nirenr ,Could you please verify this error and fixed it .

xingchch avatar Oct 26 '15 03:10 xingchch