unresolved_external
unresolved_external

Reputation: 2018

Calling C function from lua

Can someone tell me is it possible to somehow call c function or simply wrap it into a lua function WITHOUT building a new module.

Upvotes: 2

Views: 2615

Answers (3)

jpjacobs
jpjacobs

Reputation: 9559

Or the Alien library.

Upvotes: 3

lhf
lhf

Reputation: 72402

If it works for you, try the FFI library. See also luaffi.

Upvotes: 6

Amber
Amber

Reputation: 527248

Lua can't call arbitrary C functions - they have to be bound to something in the Lua namespace first. (This is intentional to prevent breaking out of sandboxes in embedded applications.)

Upvotes: 5

Related Questions