Skip to content
 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5,064 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lua

This is not the official Lua repo. This is a fork with CMake support.

Embedding in CMake project

Example project structure:

project
|-CMakeLists.txt
|-main.c
|-lua

You would probably drop the Lua folder (or submodule) in an appropriate folder. For simplicity I decided not to do that.

cmake_minimum_required(VERSION 2.4)

add_subdirectory(lua)

add_executable(my_project main.c)
target_link_libraries(my_project lua)
target_link_libraries(my_project lauxlib)
target_link_libraries(my_project lualib)

That's all. You can now use the Lua library like you want.

#include <lua.h>
#include <lauxlib.h>
#include <lualib.h>

int main(void)
{
	lua_State* state = luaL_newstate();
	luaL_openlibs(state);
	luaL_dostring(state, "print('lua <3')");
	lua_close(state);
	return 0;
}

Output:

lua <3

About

The Lua repo, as seen by the Lua team. Mirrored irregularly. Please DO NOT send pull requests. Send issues/patches to the Lua mailing list https://www.lua.org/lua-l.html

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages