1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-25 22:43:50 +01:00
RIOT/tests/pkg/lua_loader/cmodules.c
Marian Buschsieweke af266cefba
tests/[f-p]*/spdx: add SPDX tag
Co-authored-by: Ann🐸 <git@annsann.eu>
Co-authored-by: crasbe <crasbe@gmail.com>
2025-11-19 14:04:19 +01:00

53 lines
951 B
C

/*
* SPDX-FileCopyrightText: 2019 Freie Universität Berlin
* SPDX-License-Identifier: LGPL-2.1-only
*/
/**
* @{
*
* @file
* @brief Define a couple of dummy lua extension modules
*
* @author Juan Carrano <j.carrano@fu-berlin.de>
*
* Normally one would not define more than one module in a single file, but
* these modules are exactly the same: a single table with an integer value.
*
* @}
*/
#define LUA_LIB
#include "lprefix.h"
#include "lua.h"
#include "lauxlib.h"
#include "lualib.h"
static const luaL_Reg funcs[] = {
/* placeholder */
{ "X", NULL },
{ NULL, NULL }
};
static int _luaopen_X(lua_State *L, const char *xstring)
{
luaL_newlib(L, funcs);
lua_pushstring(L, xstring);
lua_setfield(L, -2, "X");
return 1;
}
int _luaopen_hello(lua_State *L)
{
return _luaopen_X(L, "E se deixa no céu,");
}
int _luaopen_world(lua_State *L)
{
return _luaopen_X(L, "como esquecida");
}