lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Lua is very well up to that task.
The steps required would be :
1. convert data file to Lua tables
- use headers as anchor points (eg. 'problem description', 'nodes',...)
- use built-in string functions and pattern matching to extract the required data and enter in tables (*)
(*) alternatively use Lpeg library

2. convert Lua tables to the desired database format
- if that is what you want to do ? (*)  But then you need to find a way to programmatically enter the data in the data base (import filters, native file format, manually copy/pasting from some Lua generated file to an open data base table or...)
- links are SQL statements ?   Not much use of generating those from Lua (are static anyway)
(*) if you want to process the data from Lua itself you can just do so of course


Anyway, if this is just for one or a few files I don't think you're going to gain much automating the process (in any programming language).  If it's to learn Lua and/or programming : nice excercise :-)

cheers ,

Wim


On Sun, Jan 15, 2012 at 9:14 AM, Sandeep Ghai <sandeep.ghai92@gmail.com> wrote:

Hello Everyone,
I am using Lua programming to make a script that helps in converting my data-file directly into database tables'.
My data -file contains many contents that needs different tables and also need the interlinking among tables. I want to do all this using Lua programming script.
Can anyone suggest me how to start and how can I proceed further. Does Lua handle this?
 
Here is the file that I need to convert.
 
problem description
title="3d Beam Sample Problem (Logan ex. 6.8, p.248)" nodes=4 elements=3

nodes
1 x=0   y=0      constraint=fixed
2 x=0   y=120    constraint=free    force=side_sway
3 x=120 y=120 			    force=twist
4 x=120 y=0      constraint=fixed

beam elements
1 nodes=[1,2] material=column
2 nodes=[2,3] material=beam 
3 nodes=[3,4] material=column

material properties
column e=30e6 ix=200 a=10
beam e=30e6 ix=100 a=10

forces
side_sway fx=10000
twist mz=5000

constraints
fixed tx=c ty=c rz=c
free tx=u ty=u rz=u

end

Thank You.
--
Sandeep Ghai
blog: http://sandeepghai.wordpress.com