Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lua to C-modules #22

Open
JlnWntr opened this issue Feb 28, 2019 · 2 comments
Open

Lua to C-modules #22

JlnWntr opened this issue Feb 28, 2019 · 2 comments

Comments

@JlnWntr
Copy link

JlnWntr commented Feb 28, 2019

Is it possible to do use luastatic for modular programming?

Usecase-example:
Let's take

  1. a string.c-file which contains some helper functions concerning strings and
  2. the actual main.c which forms the standalone program and which calls functions from string.c.

Now the special thing about string.c is, that it actually consists of lua-code, which has been converted to C-code using luastatic.

This would be very exciting.

@ers35
Copy link
Owner

ers35 commented Mar 1, 2019

How about this? Can you give a more specific example?

-- string2.lua

local string2 = {}
function string2.hello()
	return "hello"
end
return string2
-- main.lua

local string2 = require("string2")
print(string2.hello())
luastatic main.lua string2.lua /usr/lib/x86_64-linux-gnu/liblua5.3.a -I/usr/include/lua5.3
./main

@JlnWntr
Copy link
Author

JlnWntr commented Mar 26, 2019

This: https://github.com/JlnWntr/Lua-Adapter/blob/master/examples/static.cpp

It's getting interesting, when you don't need something like a main.lua anymore. If the main-application is normal C-code, while some used C-modules/routines are actually written in Lua, then your head explodes at all those possibilities.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants