diff options
-rw-r--r-- | lib/dblib.lua | 3 | ||||
-rwxr-xr-x | lib/genloadlib.sh | 10 | ||||
-rw-r--r-- | lib/loadlualibs.cc | 4 |
3 files changed, 12 insertions, 5 deletions
diff --git a/lib/dblib.lua b/lib/dblib.lua index b5d889f..5466334 100644 --- a/lib/dblib.lua +++ b/lib/dblib.lua @@ -545,6 +545,9 @@ _luadb = { stmt = stmt .. " ORDER BY `" .. options.order.by .. "` " .. direction end if options.limit then + if type(options.limit) ~= "table" then + error("Wrong type for options.limit; should be a table.") + end local start, size = 0, 30 if options.limit.start then if type(options.limit.start) ~= "number" then diff --git a/lib/genloadlib.sh b/lib/genloadlib.sh index f3b8259..c7231b1 100755 --- a/lib/genloadlib.sh +++ b/lib/genloadlib.sh @@ -1,13 +1,21 @@ #!/bin/sh +echo 'extern "C" {' ls *.lua | while read f ; do b=${f%%.*} echo "extern unsigned int size_$b;" echo "extern unsigned char $b[];" echo +done +echo '}' +echo +echo +echo 'void LoadLuaLibs(Lua * L) {' +ls *.lua | while read f ; do + b=${f%%.*} echo " Buffer ${b}_buff;" echo " ${b}_buff.write($b, size_$b);" echo " L->load(&${b}_buff);" echo - echo done +echo '}' diff --git a/lib/loadlualibs.cc b/lib/loadlualibs.cc index a100b74..ad5798c 100644 --- a/lib/loadlualibs.cc +++ b/lib/loadlualibs.cc @@ -20,8 +20,4 @@ #include <loadlualibs.h> #include <Buffer.h> -void LoadLuaLibs(Lua * L) { - #include "loadlualibs.ii" - -} |