[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua in the NetBSD kernel
- From: Steve Litt <slitt@...>
- Date: Tue, 16 Aug 2011 10:13:42 -0400
On Tuesday, August 16, 2011 07:31:34 AM Marc Balmer wrote:
> I just got it working. Here is a a transcript of a session. The
> commandline prompt is 'amd64 #', console output is prefixed with
> console:
>
> First, lets load the lua(4) module...
>
> amd64# modload lua
> console: lua0: Lua 5.1.4 Copyright (C) 1994-2008 Lua.org, PUC-Rio
>
> Now create a Lua state...
>
> amd64# luactl create s1
> console: lua0: state s1 created
>
> Now try to execute the Lua code 'print("Hello, kernel world")' from
> file ./test.lua in state s1...
>
> amd64# luactl load s1 ./test.lua
> console: lua0: loading ./test.lua into state s1
> console: lua0: error executing Lua code
> console: lua0: [string "test.lua"]:1: attempt to call global
> 'print' (a nil value)
>
> Of course! Newly created states are empty, they have no functions.
> So lets provide state s1 with the print function, it is in a Lua
> module I called luaempty. First load the module, then let s1 use
> it...
>
> amd64# modload luaempty
> console: registered lua module luaempty
> amd64# luactl require s1 luaempty
> console: lua0: requiring module luaempty to state s1
>
> Now we retry loading (and executing) ./test.lua...
>
> amd64# luactl load s1 ./test.lua
> console: Hello, kernel world
Hi Marc,
I was unable to do this in Linux. Is that surprising? I'm more
familiar with OpenBSD than NetBSD. Do you think this would work with
OpenBSD?
What's the purpose of what you did here? It sounds very interesting
but I don't understand the context. What are some of the things you
can do with this?
Thanks
SteveT
--
Steve Litt
Author: The Key to Everyday Excellence
http://www.troubleshooters.com/bookstore/key_excellence.htm
Twitter: http://www.twitter.com/stevelitt