Make rawlen the default length operation
All other similar operations, objlen and strlen, are kept for backwards
compatibility but marked as obsolete.
This allows us to provide a uniform interface across all lua versions,
based on function names used by lua 5.3.
@@ -52,26 +52,22 @@ createtable s z = liftLua $ \l ->
-- Size of objects
--
--- | See <https://www.lua.org/manual/LUA_VERSION_MAJORMINOR/manual.html#lua_objlen lua_objlen>.
-objlen :: StackIndex -> Lua Int
-
-#if LUA_VERSION_NUMBER >= 502
-{-# DEPRECATED objlen "Use rawlen instead." #-}
-objlen = rawlen
-
--- | See <https://www.lua.org/manual/5.2/manual.html#lua_objlen lua_objlen>.
+-- | See
+-- <https://www.lua.org/manual/LUA_VERSION_MAJORMINOR/manual.html#lua_rawlen
+-- lua_rawlen>.
rawlen :: StackIndex -> Lua Int
+#if LUA_VERSION_NUMBER >= 502
rawlen idx = liftLua $ \l -> fromIntegral <$> c_lua_rawlen l (fromIntegral idx)
-
#else
-objlen n = liftLua $ \l -> fromIntegral <$> c_lua_objlen l (fromIntegral n)
+rawlen idx = liftLua $ \l -> fromIntegral <$> c_lua_objlen l (fromIntegral idx)
#endif
-#if LUA_VERSION_NUMBER >= 502
+{-# DEPRECATED objlen "Use rawlen instead." #-}
+-- | Obso
+objlen :: StackIndex -> Lua Int
+objlen = rawlen
+
{-# DEPRECATED strlen "Use rawlen instead." #-}
-#else
-{-# DEPRECATED strlen "Use objlen instead." #-}
-#endif
-- | Compatibility alias for objlen
strlen :: StackIndex -> Lua Int
strlen = objlen
