Download (3 KB)
For Luanti 5.0 and above

How do I install this?

As stated, provides functionality similar to the typeof function in Luau (the Lua dialect used by Roblox) - and is used in the same way!

Creates global function typeof which can be called with any value to figure out what specific complex type it is

typeof can return two values, the type and a subdivision if possible with the type (otherwise will return nil)

type, subdivision = typeof(value)

Certain types have subdivisions such as meta which can have node and itemstack

Current specified types:

vector, voxelarea, player, object, inventory, itemstack, areastore, voxelmanip, meta (subdivisions: node, itemstack, player, storage (mod storage)), nodetimer, settings, number (subdivisions: float, integer)

The code loads certain values such as (its own) mod storage, getting meta from point 0,0,0, or getting areas of 0,0,0 to 1,1,1 as to grab their metatables for IDs. Certain types will not be available for classification prior to the finalized loading of mods due to engine limitations (such as node-specific or position-specific). Should be perfectly fine after load time. Last possible value to be loaded is the meta subdivision player - as it requires a player to join to get the metatable ID.

This function should NOT be considered a performance alternative to type(). This handles more complex types - and thusly has a slightly laggier approach - like Luau's typeof() does. It also uses type() a lot too - so it cannot be faster than it lol.

There is currently no difference between detached, node, and player inventories - and thusly there does not exist subdivisions of inventory.

Reviews

Review

Do you recommend this mod?

  • No reviews, yet.