Support for Lua added - patch from Mark Gossage

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@7365 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2005-08-15 20:58:56 +00:00
commit 127e49e03b
27 changed files with 2266 additions and 0 deletions

View file

@ -0,0 +1,25 @@
-- import
function import(module,intoglobal)
-- imports the file into the program
-- for a module example
-- this must load 'example.dll'
-- and look for the fn 'Example_Init()' (note the capitalisation)
local libname=module..".dll" -- windows
--libname=module..".so" -- unix
-- capitialising the first letter
local c=string.upper(string.sub(module,1,1))
local fnname=c..string.sub(module,2).."_Init"
assert(loadlib(libname,fnname),"error loading module:"..module)()
-- moving to global namespace
if intoglobal then
--m=raw_get(_G,module) -- gets the module object
local m=_G[module] -- gets the module object
assert(m~=nil,"no module table found")
local k,v
for k,v in m do _G[k]=v end
end
end