experimental optimize canvas:set_data using ffi

This commit is contained in:
MihailRis
2025-03-08 18:04:10 +03:00
parent 6078a8802e
commit e48216da40
6 changed files with 61 additions and 13 deletions
+11 -8
View File
@@ -88,14 +88,17 @@ static void create_libs(State* L, StateType stateType) {
void lua::init_state(State* L, StateType stateType) {
// Allowed standard libraries
pop(L, luaopen_base(L));
pop(L, luaopen_math(L));
pop(L, luaopen_string(L));
pop(L, luaopen_table(L));
pop(L, luaopen_debug(L));
pop(L, luaopen_jit(L));
pop(L, luaopen_bit(L));
pop(L, luaopen_os(L));
luaL_openlibs(L);
if (getglobal(L, "require")) {
pushstring(L, "ffi");
if (call_nothrow(L, 1, 1)) {
setglobal(L, "ffi");
}
}
pushnil(L);
setglobal(L, "io");
const char* removed_os[] {
"execute", "exit", "remove", "rename", "setlocale", "tmpname", nullptr};
remove_lib_funcs(L, "os", removed_os);