Mark Edgar |
|
Here are some miscellanenous functions for LuaInterface:
--Correction: Use array:SetValue(init[i], i-1) --instead of array[i - 1] = init[i]
The luanet/using.lua module implements both a C#-style using directive and a C#-style using statement. Here is an example incorporating both the directive and the statement forms:
require "luanet.using"('System', 'System.IO') local filename = "sample.txt" luanet.using(File:CreateText(filename), function(w) w:WriteLine("This is line one") w:WriteLine("This is line two") end) luanet.using(File:OpenText(filename), function(r) local s = r:ReadLine() while s do Console:WriteLine(s) s = r:ReadLine() end end)
The using directive allows a lua program to look up .NET classes from the global environment. The "using directive" can be used in a variety of styles:
require "luanet.using"(System, System.IO) local using = require "luanet.using" using(System, System.IO) local using = require "luanet.using" using 'System'; using 'System.IO'; require "luanet.using" 'System' 'System.IO'
-- Write to me here medgar student gc maricopa edu.
I can also be found online irc://irc.freenode.net/#lua