Skip to content

exposing external crate's (APIs) to Lua world (as a module) #117

Answered by khvzak
ildar asked this question in Q&A
Discussion options

You must be logged in to vote

This is because you need to use AnyUserData instead of &MyUserData to get your data from the table.
And then borrow it using borrow() or borrow_mut methods.
Eg:

let ud = exports.get::<_, AnyUserData>("userdata")?;
let mydata = ud.borrow::<MyUserData>()?;

Replies: 6 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by ildar
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@khvzak
Comment options

@ildar
Comment options

@khvzak
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants