Last active
January 13, 2022 07:16
-
-
Save JimOfLeisure/824bb7ebf04745ac36a13fd994def07a to your computer and use it in GitHub Desktop.
Just a quick demo of a callback in Lua, inspired by a Discord discussion
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local function just_print_it(text) | |
print(text) | |
end | |
local function print_it_backwards(text) | |
print(string.reverse(text)) | |
end | |
local function do_something(text, callback) | |
-- do neat stuff | |
callback(text) | |
end | |
do_something("hello", just_print_it) | |
do_something("goodbye", print_it_backwards) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment