|
Warning: this is an htmlized version!
The original is here, and the conversion rules are here. |
// This file:
// http://anggtwu.net/CLUA/dummy2.c.html
// http://anggtwu.net/CLUA/dummy2.c
// (find-angg "CLUA/dummy2.c")
// Skel: (find-luaso-links "~/CLUA/dummy2.c" "foo")
// Author: Eduardo Ochs <eduardoochs@gmail.com>
//
// (defun e () (interactive) (find-angg "CLUA/dummy2.c"))
#include "lauxlib.h"
#include <stdio.h>
static int my_foo(lua_State* L) {
lua_pushnumber(L, 33);
lua_pushnumber(L, 333);
return 2;
}
static const struct luaL_reg dummy2_lib[] = {
{"foo", my_foo},
{NULL, NULL}
};
LUALIB_API int luaopen_dummy2(lua_State *L) {
lua_pushvalue(L, LUA_GLOBALSINDEX);
luaL_openlib(L, NULL, dummy2_lib, 0);
return 0;
}
/*
* (find-3EE '(eepitch-shell) '(eepitch-lua51))
* (find-3ee '(eepitch-shell) '(eepitch-lua51))
*
* (eepitch-shell)
gcc -g -Wall -shared -I/usr/include/lua5.1 -o dummy2.so dummy2.c
ls -lAF dummy2*
* (eepitch-lua51)
Path.prependtocpath "~/CLUA/?.so"
require "dummy2"
print(foo(42))
*/