lua-users home
lua-l archive

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


Leave the c code as is, and try the following script. Note that the require is assigned to mylib because the module does not set the name and only returns a table. Also note that the prin function is not a global, but is in the mylib table.


#!/usr/bin/env lua

package.cpath = "./?.so;" .. package.cpath
local mylib = require("mylib")
print "\nHello World\n"
-- call a C function and send a number
local indicator = mylib.prin(1)
print("The result is ", indicator)