experimental optimize canvas:set_data using ffi
This commit is contained in:
@@ -163,20 +163,23 @@ int lua::call(State* L, int argc, int nresults) {
|
||||
int handler_pos = gettop(L) - argc;
|
||||
pushcfunction(L, l_error_handler);
|
||||
insert(L, handler_pos);
|
||||
int top = gettop(L);
|
||||
if (lua_pcall(L, argc, nresults, handler_pos)) {
|
||||
std::string log = tostring(L, -1);
|
||||
pop(L);
|
||||
remove(L, handler_pos);
|
||||
throw luaerror(log);
|
||||
}
|
||||
int added = gettop(L) - (top - argc - 1);
|
||||
remove(L, handler_pos);
|
||||
return nresults == -1 ? 1 : nresults;
|
||||
return added;
|
||||
}
|
||||
|
||||
int lua::call_nothrow(State* L, int argc, int nresults) {
|
||||
int handler_pos = gettop(L) - argc;
|
||||
pushcfunction(L, l_error_handler);
|
||||
insert(L, handler_pos);
|
||||
int top = gettop(L);
|
||||
if (lua_pcall(L, argc, -1, handler_pos)) {
|
||||
auto errorstr = tostring(L, -1);
|
||||
if (errorstr) {
|
||||
@@ -188,8 +191,9 @@ int lua::call_nothrow(State* L, int argc, int nresults) {
|
||||
remove(L, handler_pos);
|
||||
return 0;
|
||||
}
|
||||
int added = gettop(L) - (top - argc - 1);
|
||||
remove(L, handler_pos);
|
||||
return 1;
|
||||
return added;
|
||||
}
|
||||
|
||||
void lua::dump_stack(State* L) {
|
||||
|
||||
Reference in New Issue
Block a user