You're getting "attempt to call a nil value" because loadstring
returns nil
(so you're calling pcall
with nil
). loadstring
returns nil because the code you're compiling (__predecessor
) contains invalid Lua:
_ENV = {
chorda.sub = chorda.sub -- can't do this
}
FYI: The loadstring/pcall stuff is irrelevant to your problem. Had you stripped it out before posting, you would have found this error yourself.