summaryrefslogtreecommitdiff
path: root/lib/genloadlib.sh
blob: c9b2c19864c5fcb6b063ea80f31d247a9ed0f9cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/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.SetFakeName(\"@$b.lua\");"
    echo "    ${b}_buff.write($b, size_$b);"
    echo "    L->load(&${b}_buff);"
    echo
done
echo '}'