lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


  I'm working on a project, using Lua 5.3, and for reasons, all the project
specific modules live under the namespace of "GLV-1".  So far, the modules
written in Lua all load fine, but I do need one written in C.  The Lua
manual states this about a '-' in the filename:

	The fifth line is a mark to ignore all text after it when building
	the luaopen_ function name. Default is '-'.

  Okay.  Testing this out ... 

	int luaopen_GLV_getuser(lua_State *L)
	{
	  lua_pushboolean(L,1);
	  return 1;
	}

I get:

GenericUnixPrompt> lua
Lua 5.3.5  Copyright (C) 1994-2018 Lua.org, PUC-Rio
> getuser = require "GLV-1.getuser"
error loading module 'GLV-1.getuser' from file './GLV-1/getuser.so':
        ./GLV-1/getuser.so: undefined symbol: luaopen_1_getuser stack traceback:
        [C]: in ?
        [C]: in function 'require'
        stdin:1: in main chunk
        [C]: in ?

  What?  Checking Lua 5.2, I read:

	The fifth line is a mark to ignore all text before it when building
	the luaopen_ function name. Default is '-'.

  So, is the behavior of Lua 5.3 wrong?  Or is the manual wrong?  I mean,
this:

	int luaopen_1_getuser(lua_State *L)
	{
	  lua_pushboolean(L,1);
	  return 1;
	}

works:
GenericUnixPrompt> lua
Lua 5.3.5  Copyright (C) 1994-2018 Lua.org, PUC-Rio
> getuser = require "GLV-1.getuser"

  -spc (Just curious really ... )