add src-space lua
This commit is contained in:
1
space/src-c/Makefile
Normal file
1
space/src-c/Makefile
Normal file
@@ -0,0 +1 @@
|
|||||||
|
CC =
|
||||||
@@ -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
|
||||||
@@ -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))
|
||||||
|
|||||||
Reference in New Issue
Block a user