Skip to main content

chunk_id

Function chunk_id 

Source
pub fn chunk_id(out: &mut [u8], source: &[u8]) -> usize
Expand description

Fills out with a human-readable identifier derived from source and returns the number of bytes written (not including any null terminator).

Rules (matching C):

  • =... → literal text (everything after =), truncated to LUA_ID_SIZE - 1.
  • @... → file name (everything after @), prefixed with ... if too long.
  • anything else → [string "..."], with the first line truncated.

C: void luaO_chunkid (char *out, const char *source, size_t srclen)