[View]  [Edit]  [Lock]  [References]  [Attachments]  [History]  [Home]  [Changes]  [Search]  [Help] 

[m8n] workbench

The workbench is an U8 contribution (running S8 in a web page) that load Fengari library at startup.
This library let us execute Lua code in a web page.

The workbench has been used to test the S8 kernel running on top of a Standard Lua VM
Note that it is NOT a reccomended way to run m8n applications. It is valuable to let us run automated tests

Steps to try the m8n platform in your browser
Open the workbenchFollowing this link
Load snashot of m8n systemEvaluating in a workspace
| repo ext st |
repo := 'http://u8.smalltalking.net/profile/aleReimondo/m8n/'.
ext := '.lua'.
st := (#{fengari} #load: (repo ,'s8.snapshot' ,ext) fileContents) value.
Check that m8n system is runningEvaluate with showIt (result must be true)
(#{fengari} #load: 'return smalltalk:notNil()') value
Open a custom workspace to evaluate Lua expressionsRead more ...
Run the testsRead more...

More details

Finding the fengari instance

As usual, we can use the U8 toolset to inspect the library.
  1. Open a workspace
  2. Evaluate the following expression to ensure the library is loaded
    Smalltalk jsObjectAt: #fengari ifAbsent: [ self error: 'Library missing' ]
  3. Evaluate the following expression (with showIt) to see the library API
    JS@>#fengari

    See Details of some inspection results
  4. Evaluate the following expression (with showIt) to see the result of evaluating 3+4 in Lua environment
    (#{fengari} #load: 'return 3+4' as: #sample) value
  5. Inspect (inspectIt) the following expression to access the state of Lua VM
    #{fengari} basicAt: #L

Loading the m8n platform in Fengari

As your Fengari environment is installed, we can load the m8n platform on top! And have a S8 system running on top of Lua, embedded in a U8 system running in a web page.
So, we can use the U8 tools to explore, diagnose and run tests for m8n platform.

Evaluate this code to build and load a m8n snapshot
| repo ext st |
repo := 'http://u8.smalltalking.net/profile/aleReimondo/m8n/'.
ext := '.lua'.
st := (#{fengari} #load: (repo ,'s8.snapshot' ,ext) fileContents) value.

After loading m8n, the following expression should return true
(#{fengari} #load: 'return smalltalk:notNil()') value

Executing Lua expressions in m8n system

If m8n system is installed in the Lua environment the following expression will return true
(#{fengari} #load: 'return smalltalk~=nil') value

Evaluate with showIt to get the messages implemented by Object class in m8n system
(#{fengari} #load: 'return smalltalk.Object:selectors():asLiteral()') value

See also