summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--magic.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/magic.c b/magic.c
index 5642103..97fe4ca 100644
--- a/magic.c
+++ b/magic.c
@@ -112,6 +112,14 @@ static int Perror(lua_State *L)
return 1;
}
+static int Pload(lua_State *L)
+{
+ magic_t m = Pmagic_checkarg(L, 1);
+ char *filename = luaL_optstring(L, 2, NULL);
+ lua_pushstring(L, magic_load(m, filename));
+ return 1;
+}
+
static const luaL_reg Pmagic_methods[] = {
{"open", Popen},
{"close", Pclose},
@@ -121,7 +129,7 @@ static const luaL_reg Pmagic_methods[] = {
{"buffer", Ptodo},
{"error", Perror},
{"setflags", Ptodo},
- {"load", Ptodo},
+ {"load", Pload},
{"compile", Ptodo},
{"check", Ptodo},
{"list", Ptodo},