[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Advice request to build C functions in a library for Lua5.1
- From: Bradley Smith <gmane@...>
- Date: Thu, 25 Oct 2007 15:51:42 -0700
Alternatively, change mylib.c from:
LUALIB_API int luaopen_mylib (lua_State *L){
lua_newtable(L);
luaL_register(L, NULL, mylib);
return 1;
}
to:
LUALIB_API int luaopen_mylib (lua_State *L){
luaL_register(L, "mylib", mylib);
return 1;
}
and use the following script:
#!/usr/bin/env lua
package.cpath = "./?.so;" .. package.cpath
require("mylib")
print "\nHello World\n"
-- call a C function and send a number
local indicator = mylib.prin(1)
print("The result is ", indicator)