From 07924bed36e061138a5128dc2ce080634d87cb51 Mon Sep 17 00:00:00 2001 From: yenru0 Date: Thu, 8 May 2025 02:23:11 +0900 Subject: [PATCH] add src-space lua --- space/src-c/Makefile | 1 + space/src-c/{ => src}/main.c | 0 space/src-lua/Makefile | 13 +++++++++++++ space/src-lua/src/main.lua | 11 +++++++++++ 4 files changed, 25 insertions(+) create mode 100644 space/src-c/Makefile rename space/src-c/{ => src}/main.c (100%) diff --git a/space/src-c/Makefile b/space/src-c/Makefile new file mode 100644 index 0000000..98439ef --- /dev/null +++ b/space/src-c/Makefile @@ -0,0 +1 @@ +CC = \ No newline at end of file diff --git a/space/src-c/main.c b/space/src-c/src/main.c similarity index 100% rename from space/src-c/main.c rename to space/src-c/src/main.c diff --git a/space/src-lua/Makefile b/space/src-lua/Makefile index e69de29..8b56847 100644 --- a/space/src-lua/Makefile +++ b/space/src-lua/Makefile @@ -0,0 +1,13 @@ +CC = luac + +SRC_DIR = ./src + +TARGET = main.lua + +BUILD_DIR = ../../build + +build: + ${CC} -o ${BUILD_DIR}/lua.luac ${SRC_DIR}/${TARGET} + +run: build + lua ${BUILD_DIR}/lua.luac \ No newline at end of file diff --git a/space/src-lua/src/main.lua b/space/src-lua/src/main.lua index e69de29..fff1fc8 100644 --- a/space/src-lua/src/main.lua +++ b/space/src-lua/src/main.lua @@ -0,0 +1,11 @@ +local function fib(n) + if n == 0 or n == 1 then + return n + else + return fib(n - 1) + fib(n - 2) + end +end + + +local n = io.read("*n") +print(fib(n))