native_functions.md
May 22, 2025 ยท View on GitHub
Runting Native functions
NEVER CALL THE FUNCTION 'load_native_libs' IF YOU DON TRUST IN THE USER
You can load native lua functions by the usage of **load_native_libs** function#include "LuaCEmbedOne.c"
int main(int argc, char *argv[]){
LuaCEmbed * l = newLuaCEmbedEvaluation();
//NEVER USE THESE IF YOU DONT TRUST IN THE CLIENT
LuaCEmbed_load_native_libs(l);
LuaCEmbed_evaluate(l,"print('hello from lua')");
if(LuaCEmbed_has_errors(l)){
printf("error: %s\n",LuaCEmbed_get_error_message(l));
}
LuaCEmbed_free(l);
return 0;
}
It will produce:
hello from lua