Get the App
SLTechnology News&Howtos  ›  Development  › 

How to thoroughly understand the callback function through Lua

Shulou Source: shulou.com Published: 2022-06-03 05:50:19 09月30日 Update

This article is about how to thoroughly understand the callback function through Lua, the editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article.

Lua callback function instance local m = {} local list = {name= "hello", age=12} m.call_back_fun_print = function (printID) print (printID. "-->".. List [printID]) endm.add_list = function (key,value,call_back_fun) key = tostring (key) list [key] = value call_back_fun (key) endm.add_list ("address", "beijing", m.call_back_fun_print)-address-- > beijingreturn mC++ callback function instance # include # include using namespace std;typedef void (* Fun) (int,int,int) / / define the function pointer type void call_back_fun_print (int a _ line int b _ int _ int min) {cout

Tags: Functions events parameters types patterns signals pointers data messages drivers advantages multiple instances methods more processes knowledge programs articles disadvantages Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology vpn Microsoft Huawei Shulou Tech Info