diff options
author | Ted Yin <[email protected]> | 2015-05-26 15:28:26 +0800 |
---|---|---|
committer | Ted Yin <[email protected]> | 2015-05-26 15:28:26 +0800 |
commit | 565de7961df25daa3fb437bc7aac0303270387bf (patch) | |
tree | bed14c3aafe069b416a587abe5908d2b858f0716 /matrix/generic/matrix.c | |
parent | 676eb07afc1307c38c3b0089476f7cabe17cc72e (diff) | |
parent | be67a3a973bd58eff23af7add83e328c1f58451c (diff) |
Merge pull request #4 from cloudygoose/txh18-test
add nerv_matrix_(get_dataref_value) method
Diffstat (limited to 'matrix/generic/matrix.c')
-rw-r--r-- | matrix/generic/matrix.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/matrix/generic/matrix.c b/matrix/generic/matrix.c index 417c534..c3838d2 100644 --- a/matrix/generic/matrix.c +++ b/matrix/generic/matrix.c @@ -122,12 +122,18 @@ static int nerv_matrix_(nrow)(lua_State *L) { return 1; } +static int nerv_matrix_(get_dataref_value)(lua_State *L) { + Matrix *self = luaT_checkudata(L, 1, nerv_matrix_(tname)); + lua_pushinteger(L, *(self->data_ref)); + return 1; +} static const luaL_Reg nerv_matrix_(methods)[] = { {"get_elem", nerv_matrix_(get_elem)}, {"set_elem", nerv_matrix_(set_elem)}, {"ncol", nerv_matrix_(ncol)}, {"nrow", nerv_matrix_(nrow)}, + {"get_dataref_value", nerv_matrix_(get_dataref_value)}, {"__index__", nerv_matrix_(index)}, {"__newindex__", nerv_matrix_(newindex)}, {NULL, NULL} |