LRaspi  2022.1
A Lua Player for Rasberry Pi
Lua functions

Typedefs

typedef lraspi_Font ** lua_Font
 
typedef lraspi_Colour ** lua_Colour
 

Functions

void lraspi_openlibs (lua_State *L)
 Opens default LRaspi libraries. More...
 
void lraspi_dofile (lua_State *L, const char *path)
 Opens a lua file. More...
 
void lraspi_newobject (lua_State *L, const char *objname, const luaL_Reg methods[])
 Creates a new metatable that represents an object. More...
 
void lraspi_pushfont (lua_State *L, lraspi_Font *font)
 Pushes a font object onto the stack. More...
 
lua_Font lraspi_checkfont (lua_State *L, int narg)
 Checks whether the function argument narg is a font object. More...
 
lua_Font lraspi_optfont (lua_State *L, int arg, lua_Font d)
 If the function argument arg is a font object, return this font. If this argument is absent or is nil, return d. Otherwise, raises an error. More...
 
void lraspi_pushcolour (lua_State *L, lraspi_Colour *colour)
 Pushes a colour object onto the stack. More...
 
lua_Colour lraspi_checkcolour (lua_State *L, int narg)
 Checks whether the function argument narg is a colour object. More...
 
lua_Colour lraspi_optcolour (lua_State *L, int arg, lua_Colour d)
 If the function argument arg is a colour object, return this colour. If the argument is absent or is nil, return d. Otherwise, raises an error. More...
 

Detailed Description

Functions to extends Lua.

Typedef Documentation

◆ lua_Colour

Defines a colour type

◆ lua_Font

typedef lraspi_Font** lua_Font

Defines a font type

Function Documentation

◆ lraspi_checkcolour()

lua_Colour lraspi_checkcolour ( lua_State *  L,
int  narg 
)

Checks whether the function argument narg is a colour object.

Parameters
LA Lua state.
nargThe position of the argument.
Returns
A font object.

◆ lraspi_checkfont()

lua_Font lraspi_checkfont ( lua_State *  L,
int  narg 
)

Checks whether the function argument narg is a font object.

Parameters
LA Lua state.
nargThe position of the argument.
Returns
A font object.

◆ lraspi_dofile()

void lraspi_dofile ( lua_State *  L,
const char *  path 
)

Opens a lua file.

Parameters
LA Lua state.
pathThe path of the lua file.

◆ lraspi_newobject()

void lraspi_newobject ( lua_State *  L,
const char *  objname,
const luaL_Reg  methods[] 
)

Creates a new metatable that represents an object.

Parameters
LA Lua state.
objnameThe name of the object.
methodsThe methods that contains the object.

◆ lraspi_openlibs()

void lraspi_openlibs ( lua_State *  L)

Opens default LRaspi libraries.

Parameters
LA Lua state.

◆ lraspi_optcolour()

lua_Colour lraspi_optcolour ( lua_State *  L,
int  arg,
lua_Colour  d 
)

If the function argument arg is a colour object, return this colour. If the argument is absent or is nil, return d. Otherwise, raises an error.

Parameters
LA Lua state.
argThe position of the argument.
dThe default value if the argument is absent or nil.
Returns
A colour object.

◆ lraspi_optfont()

lua_Font lraspi_optfont ( lua_State *  L,
int  arg,
lua_Font  d 
)

If the function argument arg is a font object, return this font. If this argument is absent or is nil, return d. Otherwise, raises an error.

Parameters
LA Lua state.
argThe position of the argument.
dThe default value if the argument is absent or nil.
Returns
A font object.

◆ lraspi_pushcolour()

void lraspi_pushcolour ( lua_State *  L,
lraspi_Colour colour 
)

Pushes a colour object onto the stack.

Parameters
LA Lua state.
colourA colour object.

◆ lraspi_pushfont()

void lraspi_pushfont ( lua_State *  L,
lraspi_Font font 
)

Pushes a font object onto the stack.

Parameters
LA Lua state.
fontA font object.