diff options
author | Oliver Schneider <oliver@f-prot.com> | 2012-11-15 09:37:22 +0400 |
---|---|---|
committer | Oliver Schneider <oliver@f-prot.com> | 2012-11-15 09:37:22 +0400 |
commit | fc016da1afcbac614519157f1557bf4508e9b991 (patch) | |
tree | 18d468aa2899fae3efe081625bda67536839f28a /sandbox | |
parent | 2dc6905f6d3690c75d9341aafdafcc0a81bdb7e2 (diff) |
- Slight adjustments
Diffstat (limited to 'sandbox')
-rw-r--r-- | sandbox/luaconf/hello.lua | 5 | ||||
-rw-r--r-- | sandbox/luaconf/lua_conf.cpp | 6 | ||||
-rw-r--r-- | sandbox/luaconf/lua_conf.lua | 1 |
3 files changed, 11 insertions, 1 deletions
diff --git a/sandbox/luaconf/hello.lua b/sandbox/luaconf/hello.lua index 7b5f712..faf7e03 100644 --- a/sandbox/luaconf/hello.lua +++ b/sandbox/luaconf/hello.lua @@ -1,3 +1,6 @@ module(..., package.seeall)
-print "Hello world"
+-- Declare the functions you want in your module
+function hello()
+ print ("Hello, module")
+end
diff --git a/sandbox/luaconf/lua_conf.cpp b/sandbox/luaconf/lua_conf.cpp index f376fe3..fdc4702 100644 --- a/sandbox/luaconf/lua_conf.cpp +++ b/sandbox/luaconf/lua_conf.cpp @@ -67,6 +67,12 @@ namespace int status = luaL_loadbuffer(L, s, strlen(s), name) || docall(L, 0, 1);
return report(L, status);
}
+
+ static int dolibrary (lua_State *L, const char *name) {
+ lua_getglobal(L, "require");
+ lua_pushstring(L, name);
+ return report(L, lua_pcall(L, 1, 0, 0));
+ }
}
using namespace std;
diff --git a/sandbox/luaconf/lua_conf.lua b/sandbox/luaconf/lua_conf.lua index 591a841..648e1f4 100644 --- a/sandbox/luaconf/lua_conf.lua +++ b/sandbox/luaconf/lua_conf.lua @@ -31,5 +31,6 @@ for k,v in pairs(winres.scripts) do package.preload[k:upper()] = package.preload[k:lower()]
end
dumptable('package.preload', package.preload)
+dumptable('winreg', winreg)
require "helloworld"
dumptable('package.loaded', package.loaded)
|