Using constants on the Library

Is there any way of creating constants for my library?
I need to be able to do something like this:

local myLibrary = require "plugin.myLibrary" print(myLibrary.myConstantValue)

You can do something like that.  You have to open a library by calling http://pgl.yoyo.org/luai/i/luaL_register.  Then you have to push the “constant” as a c value using http://pgl.yoyo.org/luai/i/lua_pushlightuserdata.  And then you have to set the field and pop it.  It would be much easier to just have the user pass in a string and you can check against that string.

Thanks again @dchan!!

You can do something like that.  You have to open a library by calling http://pgl.yoyo.org/luai/i/luaL_register.  Then you have to push the “constant” as a c value using http://pgl.yoyo.org/luai/i/lua_pushlightuserdata.  And then you have to set the field and pop it.  It would be much easier to just have the user pass in a string and you can check against that string.

Thanks again @dchan!!