attempt to yield across metamethod/C-call boundary workaround?
Asked by
6 years ago Edited 6 years ago
Please include the code which you are trying to use, so the community will be better-equipped to help you with your problem.
Hello helpers! I am working on a Object Oriented Trello API at the moment. However, I stumbled upon a huge obstacle, which might make it impossible, however, I am not sure.
Basically, I have a metatable with the .__index metamethod in it. It allows me to "read" properties from Trello objects. Such as Board.Name, etc. However, there is an error.
attempt to yield across metamethod/C-call boundary
It happens when I try to HTTP GET from the metamethod, is there a way to work around this limitation?
Edit: Apparently I need to include the code, even though I stated exactly what I was doing, so here it is:
This is a modulescript, which in this case is the Board constructor:
01 | local HTTP = game:GetService( "HttpService" ) |
02 | local keys = require(script.Parent.Parent.keys) |
06 | function Board:GetObject(id) |
09 | Meta.__index = function (_, index) |
12 | Properties [ "Id" ] = function () |
16 | Properties [ "Name" ] = function () |
19 | return (HTTP:JSONDecode(Ret).name) |
22 | if Properties [ index ] then |
23 | return Properties [ index ] () |
25 | error (index.. " is not a valid member of Board." ) |
28 | setmetatable (NewBoard,Meta) |
Also, I am aware I should pcall() my HTTP functions, but this is a test code, it is intended for testing only, and won't be the final product.