Jump to content
  • Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal

cbrowse - inspecting lua components and other objects

Recommended Posts



cbrowse is a program you can use to inspect and modify the lua environment and components - the latter one being the reason I developed such a complex program in the first place.

You can find a detailed description in the man page.

To get a quick overview I recommend the following picture series:

Viewing and Editing



(creating and viewing a new table)


(editing it)


Default Screens



(startup screen)


(contents of "directories")


(contents of "libraries"; also: some libraries hinting at my next project)

Other Features



(indexing the table using "_V" to choose the values column and ".cn" to chose the cell containing the number 44.)


(a selection of values to show the color highlighting)


(a screen showing a string value)


Man Page


  cbrowse - inspecting lua components and other objects
  cbrowse [options] [commands...]
  cbrowse is a development tool with a heavy focus on inspecting Lua objects.
  It features a single command line as input that accepts Lua code or - when using the prefix "sh " including the space - shell commands.
  (includes tab autocompletion for Lua code)
  After hitting enter the command is executed and a list of returned values is displayed if there were any.
  You can return to the previous display via Ctrl+C. The program itself is closed by exiting the top level or via an interrupt. (Ctrl+Alt+C)
  You can reload the display by hitting F5.
  Scrolling is done via Page down/up or via using the mouse wheel.
  There are 3 types of displays:
      This contains a list of values - showing their type in one column and some text to describe their value in another one. (used as default)
      Each value has got a 1 or 2 letter identifier shown to ease access from Lua commands.
      (-> use _V.a to access the first value via Lua, _V.b for the second etc.)
      This contains a combination of keys and values and is used to display Lua tables. (used when a single table is returned)
      Each key value pair has got a 1 or 2 letter identifier as described in the previous paragraph.
      (-> use _K.a to access the first key, _V.b for the second value)
      This shows a Lua string with character based line wrapping. (used when a single string is returned)
  You are able to access a special environment using Lua commands.
  It is a proxy merging the currently viewed object with the global environment and some extra values.
  Since there may be collisions it is necessary to prioritize the contents:
    1st: special values (overrides the other contents)
      There are up to 5 of them:
        _OBJ: the currently displayed object
        _G: the global environment
        _K: a list of keys (if available)
        _V: a list of values (if available)
        _REG: a special registry table used by cbrowse to display names for non primitive values
          When using the name as an index you get the object associated with the name.
          When using an object as an index you get its name.
          You can use the registry for the following types:
            type      name format
            function  "f1234"
            userdata  "u1234"
            thread    "T1234"
            table     "t1234"
    2nd: current object (a list of values is just a table using integer indices)
    3rd: a sandboxed global environment - with automatic require
  Writing access uses the same priority but defaults to the current object as a target if the reading operation didn't find a non nil value.
  (This implies that there IS a reading operation before every writing operation. Use one of the special values to bypass that behaviour.)
  When a command calls a gpu function that might modify the screen it will make cbrowse enter a graphics debug mode:
    -The screen is cleared before the function is executed.
    -After finishing the command the screen will freeze until you hit a key.
  Changes in primary GPU and screen or resolution are also detected. (->The screen is redrawn.)
  cbrowse also supports left and right clicks on keys or values.
    A left click inserts a reference to the clicked object.
    A right click inserts "=reference" and hits enter for you.
      That way you can immediately look at an object you are interested in.
      Functions behave a bit differently:
      "=reference()" is insered and the cursor is moved one character to the left to allow you to type in parameters.
    disables loading libraries and components on startup
    This is highly recommended if you don't have a lot of memory installed.
    disables updates to the list of components
    uses the first non option parameter as a global environment (_G)
  For non option parameters it tries to find a value by using the parameter:
    1st: as a component address
    2nd: to get a primary component
    3rd: as a library name
    4th: as code executed via the cbrowse command line
  Using the --raw option disables this behaviour and instead uses arguments without processing. (useful if you call cbrowse for debugging your own program)
    starts cbrowse in the default screen
  cbrowse --clean
    starts cbrowse without loading all libraries and components available on the computer
      sh ls
        executes command "ls" in the shell
        cbrowse is waiting for a key input after execution because ls printed some output. (You should have a chance to read it after all.)
  cbrowse redstone
    The initial screen now contains a reference "==default==" to the default object and a reference "redstone" to a redstone component proxy.
        move to the loaded redstone component
        show the redstone input at the northern side of the redstone component
  cbrowse can be used as a debugging aid by executing it from within your program:
    local a, b, c = "test", 3.14, os
    require"cbrowse".view(a, b, c)
  Some words of advice though:
      It will consume events using event.pull. (like term.read)
      If you expect to pull some events after running it, it might change the programs behaviour.
      Due to a limitation of shell.execute you can't have nil values as a parameter. All values after a nil value are just ignored.
      (The library is just a shortcut for a shell.execute call.)
      If you need that function, consider using a table:
        require"cbrowse".view{a, b, c}






All required libraries are included in the download.



GPU +  screen: min. 20x7 monochrome, 80x25 with colors recommended

RAM: min. 384 KiB, recommended: >=512 KiB




Simply download the tar archive and extract it into the root directory.

All files should then be there where they should be.


Download (last update: 13.04.17)





wget 'https://raw.githubusercontent.com/mpmxyz/ocprograms/master/tars/cbrowse.tar'
tar -xf cbrowse.tar


oppm install cbrowse

Known Issues


There is no shell autocompletion. (I still need to look into it.)

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.