whiskers 0.4.0
RP2350 BadUSB Tool
Loading...
Searching...
No Matches
wlua.h File Reference

Detailed Description

Basic functions to setup the lua functionality.

Author
zane

These functions only initialize and start lua as a whole on the device. All functionality that is built in is within wlua.c, wlua_fops.c, and wlua_usb.c.

To find the list of all the exposed lua functions see lua_functions.h

#include "../../hal/file.h"
#include "../../hal/standard.h"
#include "../../lua/lua.h"
#include "../../lua/lualib.h"
#include "../../lua/lauxlib.h"
#include "wlua_fops.h"
#include "wlua_usb.h"
#include "../usb/wusb.h"
#include <string.h>
#include <stdio.h>

Go to the source code of this file.

Macros

#define WLUA_MAX_LINESIZE   1024
 Max line length to parse from a file into the lua interpreter.

Functions

void start_lua (lua_State **lua)
 Sets up the initial lua state and registers all the exposed functions for user use in lua code.
bool run_lua_from_file (const char *path, lua_State *lua)
 Runs lua from a file.
void stop_lua (lua_State *lua)
 Stops the lua interpreter and frees it's resources.

Function Documentation

◆ run_lua_from_file()

bool run_lua_from_file ( const char * path,
lua_State * lua )

Runs lua from a file.

Parameters
*pathPath to file.
*lualua_State that has been initialized by start_lua();
Returns
True on success, and false if the file cannot be opened.

◆ start_lua()

void start_lua ( lua_State ** lua)

Sets up the initial lua state and registers all the exposed functions for user use in lua code.

Parameters
**luaPointer to an empty lua_State struct pointer. This function initializes this and this must be kept and re-used in all the functions.

◆ stop_lua()

void stop_lua ( lua_State * lua)

Stops the lua interpreter and frees it's resources.

Parameters
*luaActive lua instance to be stopped and freed.