c/lua:register

This commit is contained in:
luoliwoshang
2024-08-25 12:32:31 +08:00
parent 54ce1d8d2f
commit cf8a170133
2 changed files with 7 additions and 6 deletions

View File

@@ -31,10 +31,8 @@ func main() {
L.Atpanic(customPanic)
L.Pushcfunction(triggerError)
L.Setglobal(c.Str("trigger_error"))
L.Pushcfunction(triggerFormatError)
L.Setglobal(c.Str("trigger_format_error"))
L.Register(c.Str("trigger_error"), triggerError)
L.Register(c.Str("trigger_format_error"), triggerFormatError)
c.Printf(c.Str("1. error (protected):\n"))
L.Getglobal(c.Str("trigger_error"))