Identifier names and hashes - AtomCrafty/MajiroTools Wiki

Identifier names and hashes

All identifier names (variables and functions) follow strict rules to maintain a type system without needing any extra work done at compile time.

Prefixes and scope

Prefixes determine the scope (location) of variables, and also identify functions.

Char Usage Scope Code
# var persistent 0
@ var savefile 1
% & var thread 2
_ varparam local 3
$ func - -

Postfixes and type

Postfixes identify the type of a variable, and the type of a function's return. Although arrays can be accessed with 1~3 dimensions, all arrays are 3D, so the # postfix does not change with dimensions.

Char Type Code Internal Name
int 0
% ! float 1
$ string 2
# intarray 3 INT_ARRAY
%# !# floatarray 4 FIXED_ARRAY
$# stringarray 5 STRING_ARRAY


Namespaces are placed after the identifier and postfix, and are used to avoid name conflicts.

Example: #[email protected] defines a persistent scope, int type variable with the GLOBAL namespace.

Most scripts will use their own namespace. The source syntax for defining this is:

#group "GROUPNAME"

Local variables and function arguments have no namespace, i.e. [email protected] is the identifier. Global variables have the @GLOBAL namespace.

Compile behavior: When no trailing @ is added, the current scope is used for declarations (i.e. the current #group) for the script, and @ for inside a function. Variables (and possibly function declarations) can explicitly define a different group if needed. If no #group specifier is in the script, the default group @GLOBAL is used. For all other calls and variables not defined in the current script, the group name is assumed based on what has been declared in any .mjh header files. Syscalls use the group name @MAJIRO_INTER.

Runtime behavior: When using the $get_variable and $set_variable syscalls, @GLOBAL is appended by default if no namespace is included.


Identifier names are stored as a standard CRC-32 hash. The hash is done with prefixes, postfixes, and full namespace attached. Just like user-defined functions and variables, syscall hashes use the full identifier name but with the group @MAJIRO_INTER. So $abs -> [email protected]_INTER, and $cos% -> $cos%@MAJIRO_INTER.

See the unhash_name tool for brute-force reversing name hashes. Works best with short local variables.