-
Notifications
You must be signed in to change notification settings - Fork 73
Description
I've noticed that when calling require from Lua.js, it doesn't return anything. The code inserted into each compiled Lua module is:
G.str['require'] = function (name) {
lua_require(G, name);
};Lua's reference manual states that require should return a value:
Once a loader is found,
requirecalls the loader with a single argument,modname. If the loader returns any value,requireassigns the returned value topackage.loaded[modname]. If the loader returns no value and has not assigned any value topackage.loaded[modname], thenrequireassignstrueto this entry. In any case, require returns the final value ofpackage.loaded[modname].
Lua.js isn't doing the bolded part.
I may submit a patch for this if I can figure it out. This is part of my attempt to get the table method of defining a module to work in Lua.js (see #13).